Skip to content

Commit

Permalink
Fix custom paths on Windows
Browse files Browse the repository at this point in the history
QDir apparently already handled what I was trying to do manually. Oops.

Also forgot to flip the check that adds the trailing backslash to the path. Big oops.
  • Loading branch information
SeongGino authored Mar 26, 2024
1 parent 48b2193 commit f350055
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <QCoreApplication>
#include <QTimer>
#include <QDir>
#include "qhookermain.h"

int main(int argc, char *argv[])
Expand All @@ -22,18 +23,15 @@ int main(int argc, char *argv[])
}
if(arguments.contains("-p")) {
if(arguments.length() > 1) {
mainApp.customPath = arguments[arguments.indexOf("-p")+1];
mainApp.customPath = QDir::fromNativeSeparators(arguments[arguments.indexOf("-p")+1]);
#ifdef Q_OS_WIN
if(mainApp.customPath.contains('/')) {
mainApp.customPath.replace('/', '\\');
}
if(mainApp.customPath.contains(":\\") || mainApp.customPath.contains(":/")) {
if(mainApp.customPath.contains(":\\")) {
#else
if(mainApp.customPath.contains("/")) {
#endif // Q_OS_WIN
mainApp.customPathSet = true;
#ifdef Q_OS_WIN
if(mainApp.customPath.endsWith('\\')) {
if(!mainApp.customPath.endsWith('\\')) {
mainApp.customPath.append('\\');
}
#else
Expand Down

0 comments on commit f350055

Please sign in to comment.