Skip to content

Commit

Permalink
fix: output path
Browse files Browse the repository at this point in the history
  • Loading branch information
DuanKuanJun committed May 22, 2024
1 parent a176e1f commit 4f2bc5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/benchCsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ int genWithSTable(SDataBase* db, SSuperTable* stb, char* outDir) {


void obtainCsvFile(char * outFile, SDataBase* db, SSuperTable* stb, char* outDir) {
sprintf(outFile, "%s//%s-%s.csv", outDir, db->dbName, stb->stbName);
sprintf(outFile, "%s%s-%s.csv", outDir, db->dbName, stb->stbName);
}



int32_t writeCsvFile(FILE* f, char * buf, int32_t len) {
size_t size = fwrite(buf, 1, len, f);
if(size != len) {
Expand Down
12 changes: 10 additions & 2 deletions src/benchJsonOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,9 +1433,17 @@ static int getMetaFromCommonJsonFile(tools_cJSON *json) {
tstrncpy(g_arguments->csvPath, csv->valuestring, MAX_FILE_NAME_LEN);
}

if(g_arguments->csvPath[0] == 0) {
size_t len = strlen(g_arguments->csvPath);

if(len == 0) {
// set default with current path
strcpy(g_arguments->csvPath, "./output");
strcpy(g_arguments->csvPath, "./output/");
mkdir(g_arguments->csvPath, 0775);
} else {
// append end
if (g_arguments->csvPath[len-1] != '/' ) {
strcat(g_arguments->csvPath, "/");
}
mkdir(g_arguments->csvPath, 0775);
}

Expand Down

0 comments on commit 4f2bc5f

Please sign in to comment.