Skip to content

Commit

Permalink
fix tars2node --base bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Feb 16, 2025
1 parent dd2544c commit c9d4363
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tools/tars2node/code_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void CodeGenerator::createFile(const string &file, const bool bEntry)
node.setStreamPath(_sStreamPath);
node.setTargetPath(_sToPath);
node.setRecursive(_bRecursive);
node.setUseSpecialPath(_bUseSpecialPath);
// node.setUseSpecialPath(_bUseSpecialPath);
node.setLongType(_iLongType);
node.setStringBinaryEncoding(_bStringBinaryEncoding);
node.setMinimalMembers(_bMinimalMembers);
Expand Down
6 changes: 3 additions & 3 deletions tools/tars2node/code_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CodeGenerator
_bServer(false),
_bWeb(false),
_bRecursive(false),
_bUseSpecialPath(false),
// _bUseSpecialPath(false),
_iLongType(Number),
_bStringBinaryEncoding(false),
_bEnumReverseMappings(false),
Expand All @@ -106,7 +106,7 @@ class CodeGenerator

void setRecursive(bool bEnable) { _bRecursive = bEnable; }

void setUseSpecialPath(bool bEnable) { _bUseSpecialPath = bEnable; }
// void setUseSpecialPath(bool bEnable) { _bUseSpecialPath = bEnable; }

void setLongType(int iLongType) { _iLongType = iLongType; }

Expand Down Expand Up @@ -309,7 +309,7 @@ class CodeGenerator

bool _bRecursive;

bool _bUseSpecialPath;
// bool _bUseSpecialPath;

int _iLongType;

Expand Down
17 changes: 9 additions & 8 deletions tools/tars2node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ int main(int argc, char* argv[])
{
TC_Option option;
option.decode(argc, argv);

if(option.hasParam("base"))
{
if (::chdir(option.getValue("base").c_str()) != 0) {
return -1;
}
}

vector<string> vFiles = option.getSingle();
check(vFiles);

Expand All @@ -103,13 +111,6 @@ int main(int argc, char* argv[])
return 0;
}

if(option.hasParam("base"))
{
if (::chdir(option.getValue("base").c_str()) != 0) {
return -1;
}
}

#define ALLOW_USE_RESERVED_NAMESPACE_V(name, keeped) \
g_parse->set##name(keeped);
#define ALLOW_USE_RESERVED_NAMESPACE_BASE(name, keeped) \
Expand All @@ -134,7 +135,7 @@ int main(int argc, char* argv[])
generator.setEnableServer(option.hasParam("server"));
generator.setEnableWeb(option.hasParam("web"));
generator.setTargetPath(option.hasParam("dir")?option.getValue("dir"):"./");
generator.setUseSpecialPath(option.hasParam("relative"));
// generator.setUseSpecialPath(option.hasParam("relative"));
generator.setStringBinaryEncoding(option.hasParam("string-binary-encoding"));
generator.setEnumReverseMappings(option.hasParam("enum-reverse-mappings"));
generator.setEnableTS(option.hasParam("ts"));
Expand Down

0 comments on commit c9d4363

Please sign in to comment.