Skip to content

Commit

Permalink
Fix ice2slice to honor --output-dir - #3289 (#3308)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Jan 5, 2025
1 parent ec19397 commit e99d2e5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cpp/src/ice2slice/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ compile(const vector<string>& argv)

bool preprocess = opts.isSet("E");

string output = opts.optArg("output-dir");
string outputDir = opts.optArg("output-dir");

bool debug = opts.isSet("debug");

Expand Down Expand Up @@ -194,9 +194,17 @@ compile(const vector<string>& argv)
DefinitionContextPtr dc = p->findDefinitionContext(p->topLevelFile());
assert(dc);

string baseName = icecpp->getBaseName();
// Remove any directory components from the base name.
string::size_type pos = baseName.find_last_of("/\\");
if (pos != string::npos)
{
baseName = baseName.substr(pos);
}

try
{
Gen gen(icecpp->getBaseName());
Gen gen(outputDir + baseName);
gen.generate(p);
}
catch (const Slice::FileException& ex)
Expand Down

0 comments on commit e99d2e5

Please sign in to comment.