Skip to content

Commit

Permalink
Forwardslashes are used on both OSes
Browse files Browse the repository at this point in the history
Thank Parace for that.
And fuck Parace for wasting a few minutes of my life finding this out.
  • Loading branch information
SeongGino authored Mar 26, 2024
1 parent 3d61462 commit a49b156
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,17 @@ int main(int argc, char *argv[])
if(arguments.contains("-p")) {
if(arguments.length() > 1) {
mainApp.customPath = QDir::fromNativeSeparators(arguments[arguments.indexOf("-p")+1]);
// QDir::fromNativeSeparators uses forwardslashes on both OSes, thank Parace
#ifdef Q_OS_WIN
if(mainApp.customPath.contains(':')) {
// closest way to check for drive letter, since colons aren't allowed in Windows filenames anyways
if(mainApp.customPath.contains(":/")) {
#else
if(mainApp.customPath.contains('/')) {
#endif // Q_OS_WIN
mainApp.customPathSet = true;
#ifdef Q_OS_WIN
if(!mainApp.customPath.endsWith('\\')) {
mainApp.customPath.append('\\');
}
#else
if(!mainApp.customPath.endsWith('/')) {
mainApp.customPath.append('/');
}
#endif // Q_OS_WIN
qInfo() << "Setting search path to" << mainApp.customPath;
arguments.removeAt(arguments.indexOf("-p")+1);
} else {
Expand Down

0 comments on commit a49b156

Please sign in to comment.