Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SRC/dictionarySystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ void ShowStats(bool reset)
void WriteDictDetailsBeforeLayer(int layer)
{
char word[MAX_WORD_SIZE];
sprintf(word,(char*)"TMP/prebuild%d.bin",layer);
sprintf(word,(char*)"%s/prebuild%d.bin",tmp, layer);
FILE* out = FopenBinaryWrite(word); // binary file, no BOM
if (out)
{
Expand Down Expand Up @@ -1137,7 +1137,7 @@ void WriteDictDetailsBeforeLayer(int layer)
static void ReadDictDetailsBeforeLayer(int layer)
{
char word[MAX_WORD_SIZE];
sprintf(word,(char*)"TMP/prebuild%d.bin",layer);
sprintf(word,(char*)"%s/prebuild%d.bin",tmp,layer);
int oldBOM = BOM;
FILE* in = FopenReadWritten(word); // binary file, no BOM
if (in)
Expand Down
5 changes: 4 additions & 1 deletion SRC/mainSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ bool nosuchbotrestart = false; // restart if no such bot
char users[100];
char logs[100];
char topic[100];
char tmp[100];
char buildfiles[100];
char* derivationSentence[MAX_SENTENCE_LENGTH];
int derivationLength;
Expand Down Expand Up @@ -583,6 +584,7 @@ static void ProcessArgument(char* arg)
else if (!strnicmp(arg,(char*)"users=",6 )) strcpy(users,arg+6);
else if (!strnicmp(arg,(char*)"logs=",5 )) strcpy(logs,arg+5);
else if (!strnicmp(arg,(char*)"topic=",6 )) strcpy(topic,arg+6);
else if (!strnicmp(arg,(char*)"tmp=",4 )) strcpy(tmp,arg+4);
else if (!strnicmp(arg, (char*)"buildfiles=", 11)) strcpy(buildfiles, arg + 11);
else if (!strnicmp(arg,(char*)"private=",8)) privateParams = arg+8;
else if (!stricmp(arg,(char*)"treetagger")) strcpy(treetaggerParams,"1");
Expand Down Expand Up @@ -684,7 +686,6 @@ static void ReadConfig()
unsigned int InitSystem(int argcx, char * argvx[],char* unchangedPath, char* readablePath, char* writeablePath, USERFILESYSTEM* userfiles, DEBUGAPI infn, DEBUGAPI outfn)
{ // this work mostly only happens on first startup, not on a restart
strcpy(hostname,(char*)"local");
MakeDirectory((char*)"TMP");
*sourceInput = 0;
*buildfiles = 0;
*apikey = 0;
Expand Down Expand Up @@ -714,6 +715,7 @@ unsigned int InitSystem(int argcx, char * argvx[],char* unchangedPath, char* rea
strcpy(users,(char*)"USERS");
strcpy(logs,(char*)"LOGS");
strcpy(topic,(char*)"TOPIC");
strcpy(tmp,(char*)"TMP");

strcpy(language,(char*)"ENGLISH");

Expand Down Expand Up @@ -756,6 +758,7 @@ unsigned int InitSystem(int argcx, char * argvx[],char* unchangedPath, char* rea

ReadConfig();
ProcessArguments(argc,argv);
MakeDirectory(tmp);
if (argumentsSeen) printf("\r\n");
argumentsSeen = false;

Expand Down
1 change: 1 addition & 0 deletions SRC/mainSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ extern bool shortPos;
extern char users[100];
extern char logs[100];
extern char topic[100];
extern char tmp[100];
extern char buildfiles[100];

// pending control
Expand Down
11 changes: 8 additions & 3 deletions SRC/scriptCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,9 @@ static void WriteKey(char* word)
{
if (!compiling || spellCheck != NOTE_KEYWORDS || *word == '_' || *word == '\'' || *word == USERVAR_PREFIX || *word == SYSVAR_PREFIX || *word == '@') return;
StoreWord(word);
FILE* out = FopenUTF8WriteAppend((char*)"TMP/keys.txt");
char file[SMALL_WORD_SIZE];
sprintf(file,(char*)"%s/keys.txt",tmp);
FILE* out = FopenUTF8WriteAppend(file);
if (out)
{
DownHierarchy(MakeMeaning(StoreWord(word)),out,0);
Expand Down Expand Up @@ -5028,15 +5030,18 @@ static void WriteDictionaryChange(FILE* dictout, unsigned int build)
{
// Note that topic labels (topic.name) and pattern words will not get written
FILE* in = NULL;
char file[SMALL_WORD_SIZE];
int layer = 0;
if ( build == BUILD0)
{
in = FopenReadWritten((char*)"TMP/prebuild0.bin");
sprintf(file,(char*)"%s/prebuild0.bin",tmp);
in = FopenReadWritten(file);
layer = 0;
}
else if ( build == BUILD1)
{
in = FopenReadWritten((char*)"TMP/prebuild1.bin");
sprintf(file,(char*)"%s/prebuild1.bin",tmp);
in = FopenReadWritten(file);
layer = 1;
}
if (!in)
Expand Down
8 changes: 4 additions & 4 deletions SRC/userSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,11 @@ void WriteUserData(time_t curr)
if (filesystemOverride == NORMALFILES && (!server || serverRetryOK) && !documentMode && !callback)
{
char fname[MAX_WORD_SIZE];
sprintf(fname,(char*)"TMP/backup-%s_%s.bin",loginID,computerID);
sprintf(fname,(char*)"%s/backup-%s_%s.bin",tmp,loginID,computerID);
CopyFile2File(fname, name,false); // backup for debugging BUT NOT if callback of some kind...
if (redo) // multilevel backup enabled
{
sprintf(fname,(char*)"TMP/backup%d-%s_%s.bin",volleyCount,loginID,computerID);
sprintf(fname,(char*)"%s/backup%d-%s_%s.bin",tmp,volleyCount,loginID,computerID);
CopyFile2File(fname,userDataBase,false); // backup for debugging BUT NOT if callback of some kind...
}
}
Expand All @@ -664,11 +664,11 @@ void WriteUserData(time_t curr)
#ifndef DISCARDTESTING
if (filesystemOverride == NORMALFILES && (!server || serverRetryOK) && !documentMode && !callback)
{
sprintf(name,(char*)"TMP/backup-share-%s_%s.bin",loginID,computerID);
sprintf(name,(char*)"%s/backup-share-%s_%s.bin",tmp,loginID,computerID);
CopyFile2File(name,userDataBase,false); // backup for debugging
if (redo)
{
sprintf(name,(char*)"TMP/backup%d-share-%s_%s.bin",volleyCount,loginID,computerID);
sprintf(name,(char*)"%s/backup%d-share-%s_%s.bin",tmp,volleyCount,loginID,computerID);
CopyFile2File(name,userDataBase,false); // backup for debugging BUT NOT if callback of some kind...
}
}
Expand Down