updated basename fix for multi-platform

This commit is contained in:
itsmattkc
2020-09-05 18:56:30 +10:00
parent 8e7fb70e73
commit 68233b9402
+9 -9
View File
@@ -115,24 +115,24 @@ void CommandLineParser::PrintHelp(const char* filename)
}
const char* basename;
bool path = true;
#ifdef Q_OS_WINDOWS
basename = strrchr(filename, '\\');
if (!basename) {
basename = strrchr(filename, '/');
}
// If no slashes are found we are probably running Olive from the executables own directory
// so we set basename equal to the filename (olive-editor.exe). This ensures basename is
// always valid.
if (!basename) {
basename = filename;
path = false;
}
#else
basename = strrchr(filename, '/');
#endif
printf("Usage: %s [options] %s\n\n", path ? basename + 1 : basename, positional_args.toUtf8().constData());
if (basename) {
// Slash found, increment pointer to avoid showing the slash itself
basename++;
} else {
// If no slashes are found, assume string is already a basename
basename = filename;
}
printf("Usage: %s [options] %s\n\n", basename, positional_args.toUtf8().constData());
foreach (const KnownOption& o, options_) {
QString all_args;