Skip to content

Commit b391708

Browse files
committed
Fixed input and output filename options to allow spaces in filenames
It seems that boost::program_options::value<boost::filesystem::path> doesn't allow filenames containing spaces. boostorg/program_options#69 See #195
1 parent 9966b78 commit b391708

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Options.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ bool Options::parseCommandLine(int argc, const char* const* argv)
134134
{
135135
program_name_ = argv[0];
136136

137+
std::string input_filename;
138+
std::string output_filename;
139+
137140
std::string input_format;
138141
std::string output_format;
139142

@@ -152,13 +155,13 @@ bool Options::parseCommandLine(int argc, const char* const* argv)
152155
"disable progress and information messages"
153156
)(
154157
"input-filename,i",
155-
po::value<boost::filesystem::path>(&input_filename_),
158+
po::value<std::string>(&input_filename),
156159
FileFormat::isSupported(FileFormat::Opus) ?
157160
"input file name (.mp3, .wav, .flac, .ogg, .oga, .opus, .dat, .json)" :
158161
"input file name (.mp3, .wav, .flac, .ogg, .oga, .dat, .json)"
159162
)(
160163
"output-filename,o",
161-
po::value<boost::filesystem::path>(&output_filename_),
164+
po::value<std::string>(&output_filename),
162165
"output file name (.wav, .dat, .png, .json)"
163166
)(
164167
"split-channels",
@@ -308,6 +311,12 @@ bool Options::parseCommandLine(int argc, const char* const* argv)
308311
}
309312
}
310313

314+
// TODO: po::value<boost::filesystem::path> doesn't allow filenames
315+
// containing spaces.
316+
// See https://github.com/boostorg/program_options/issues/69
317+
input_filename_ = input_filename;
318+
output_filename_ = output_filename;
319+
311320
has_input_format_ = hasOptionValue(variables_map, "input-format");
312321
has_output_format_ = hasOptionValue(variables_map, "output-format");
313322

0 commit comments

Comments
 (0)