NGLayout only. Setting the default dirs for NS_NET_FILE to be rooted in the current working directory rather than hardcoded.
git-svn-id: svn://10.0.0.236/trunk@10855 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -23,23 +23,18 @@
|
||||
|
||||
// These defines are for temporary use until we get a real dir manager.
|
||||
#define USER_DIR_TOK "%USER%"
|
||||
#define USER_DIR "e:\\projects\\ng"
|
||||
#define CACHE_DIR_TOK "%CACHE_D%"
|
||||
#define CACHE_DIR "e:\\projects\\ng\\cache"
|
||||
#define DEF_DIR_TOK "%DEF_D%"
|
||||
|
||||
#define COOKIE_FILE_TOK "%COOKIE_F%"
|
||||
|
||||
#define CACHE_DB_F_TOK "%CACHE_DB_F%"
|
||||
#define CACHE_DB_FILE "fat.db"
|
||||
|
||||
#ifdef XP_PC
|
||||
#define COOKIE_FILE "cookies.txt"
|
||||
#else
|
||||
#define COOKIE_FILE "cookies"
|
||||
#endif
|
||||
|
||||
#define DEF_DIR_TOK "%DEF_D%"
|
||||
#define DEF_DIR "e:\\projects\\ng"
|
||||
|
||||
#define CACHE_DB_F_TOK "%CACHE_DB_F%"
|
||||
#define CACHE_DB_FILE "fat.db"
|
||||
|
||||
// {9E04ADC2-2B1D-11d2-B6EB-00805F8A2676}
|
||||
#define NS_INETFILE_IID \
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#include "direct.h"
|
||||
#include <time.h>
|
||||
|
||||
char USER_DIR[_MAX_PATH];
|
||||
char CACHE_DIR[_MAX_PATH];
|
||||
char DEF_DIR[_MAX_PATH];
|
||||
|
||||
static NS_DEFINE_IID(kINetFileIID, NS_INETFILE_IID);
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsNetFile, kINetFileIID);
|
||||
|
||||
@@ -31,9 +31,14 @@
|
||||
|
||||
#ifdef NS_NET_FILE
|
||||
|
||||
extern char *USER_DIR;
|
||||
extern char *CACHE_DIR;
|
||||
extern char *DEF_DIR;
|
||||
|
||||
// For xp to ns file translation
|
||||
#include "nsINetFile.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "direct.h"
|
||||
|
||||
// The nsINetfile
|
||||
static nsINetFile *fileMgr = nsnull;
|
||||
@@ -1000,6 +1005,33 @@ NET_I_XP_FileSeek(XP_File fp, long offset, int origin) {
|
||||
// Directories and files are platform specific.
|
||||
PUBLIC PRBool
|
||||
NET_InitFilesAndDirs(void) {
|
||||
PRFileInfo dir;
|
||||
PRStatus status;
|
||||
char tmpBuf[_MAX_PATH];
|
||||
#ifdef XP_PC
|
||||
char *mDirDel = "\\";
|
||||
#elif XP_MAC
|
||||
char *mDirDel = ":";
|
||||
#else
|
||||
char *mDirDel = "/";
|
||||
#endif
|
||||
|
||||
// Setup directories, step 1.
|
||||
USER_DIR = _getcwd(USER_DIR, _MAX_PATH);
|
||||
CACHE_DIR = _getcwd(CACHE_DIR, _MAX_PATH);
|
||||
DEF_DIR = _getcwd(DEF_DIR, _MAX_PATH);
|
||||
|
||||
// setup the cache dir.
|
||||
PL_strcpy(tmpBuf, CACHE_DIR);
|
||||
sprintf(CACHE_DIR,"%s%s%s%s", tmpBuf, mDirDel, "cache", mDirDel);
|
||||
status = PR_GetFileInfo(CACHE_DIR, &dir);
|
||||
if (status == PR_FAILURE) {
|
||||
// Create the dir.
|
||||
status = PR_MkDir(CACHE_DIR, 0600);
|
||||
if (status != PR_SUCCESS) {
|
||||
; // bummer!
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileMgr) {
|
||||
if (NS_NewINetFile(&fileMgr, nsnull) != NS_OK) {
|
||||
|
||||
Reference in New Issue
Block a user