Adding a default directory for the new cache when it's being used in modular_netlib and for windows only. I also added the cache.lib to be dumped to the public dist dir when built.

This commit is contained in:
valeski%netscape.com 1998-11-06 05:43:01 +00:00
Родитель 51dc794a78
Коммит cd8a8758a2
2 изменённых файлов: 33 добавлений и 1 удалений

6
network/cache/nu/src/makefile.win поставляемый
Просмотреть файл

@ -33,7 +33,7 @@ LLIBS = \
$(DIST)\lib\libplc21.lib \
$(DIST)\lib\dbm32.lib \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\libpref.lib \
$(DIST)\lib\libpref.lib \
$(NULL)
MISCDEP = $(LLIBS)
@ -75,6 +75,10 @@ include <$(DEPTH)\config\rules.mak>
install:: $(EXE)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).$(LIB_SUFFIX) $(DIST)\lib
libs:: $(LIBRARY)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).$(LIB_SUFFIX) $(DIST)\lib
# $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).$(DLL_SUFFIX) $(DIST)\bin
clobber::

28
network/cache/nu/src/nsCachePref.cpp поставляемый
Просмотреть файл

@ -24,6 +24,10 @@
#include "prmem.h"
#include "nsCacheManager.h"
#include "plstr.h"
#if defined(MODULAR_NETLIB) && defined(XP_PC)
#include <direct.h>
#include "nspr.h"
#endif /* MODULAR_NETLIB */
#ifdef XP_MAC
#include "uprefd.h"
@ -153,10 +157,34 @@ nsCachePref::SetupPrefs(const char* i_Pref)
#endif
else //TODO set to temp folder
{
#if defined(MODULAR_NETLIB) && defined(XP_PC)
char tmpBuf[_MAX_PATH];
PRFileInfo dir;
PRStatus status;
char *cacheDir = new char [_MAX_PATH];
if (!cacheDir)
return;
cacheDir = _getcwd(cacheDir, _MAX_PATH);
// setup the cache dir.
PL_strcpy(tmpBuf, cacheDir);
sprintf(cacheDir,"%s%s%s%s", tmpBuf, "\\", "cache", "\\");
status = PR_GetFileInfo(cacheDir, &dir);
if (PR_FAILURE == status) {
// Create the dir.
status = PR_MkDir(cacheDir, 0600);
if (PR_SUCCESS != status) {
m_DiskCacheFolder = 0;
return;
}
}
m_DiskCacheFolder = cacheDir;
#else
m_DiskCacheFolder = new char [1];
if (!m_DiskCacheFolder)
return;
*m_DiskCacheFolder = '\0';
#endif /* MODULAR_NETLIB */
}
}