Skip to content

Commit

Permalink
Fix ice2slice to honor --output-dir - zeroc-ice#3289
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Dec 26, 2024
1 parent 075234d commit 654d030
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 654d030

Please sign in to comment.