windows functioning update

This commit is contained in:
jkibbels 2025-02-08 15:25:06 -05:00
parent 29186b549e
commit c3fada4365

View File

@ -58,7 +58,6 @@ void MainWindow::UpdateProgress(qint64 read, qint64 total) {
void MainWindow::FinishedDownloading() { void MainWindow::FinishedDownloading() {
QByteArray data = reply->readAll(); QByteArray data = reply->readAll();
downloadLocation = "/home/jesse/Downloads/mods.zip";
QFile file(downloadLocation); QFile file(downloadLocation);
@ -81,12 +80,11 @@ void MainWindow::FinishedDownloading() {
std::string MainWindow::BuildUnzipCmd() { std::string MainWindow::BuildUnzipCmd() {
std::stringstream ss; std::stringstream ss;
#ifdef _WINDOWS #ifdef WIN64
ss << "tar -xf " << downloadLocation.toStdString() << " -C " << modsDir.toStdString(); ss << "tar -xf " << downloadLocation.toStdString() << " -C " << modsDir.toStdString();
#elif __unix__ #elif __unix__
ss << "unzip " << downloadLocation.toStdString() << " -d " << modsDir.toStdString(); ss << "unzip " << downloadLocation.toStdString() << " -d " << modsDir.toStdString();
#endif #endif
qDebug() << "Tar command is: " << ss.str();
return ss.str(); return ss.str();
} }
@ -139,8 +137,9 @@ void MainWindow::UpdateOSAgnosticInformation() {
char* appDataLoc = std::getenv("APPDATA"); char* appDataLoc = std::getenv("APPDATA");
if (appDataLoc) { if (appDataLoc) {
std::filesystem::path execPath(appDataLoc); std::filesystem::path execPath(appDataLoc);
downloadLocation = QString(execPath.c_str()); // Stick the mods inside the roaming directory; but not the .minecraft directory itself. downloadLocation = QString::fromStdString(execPath.string()); // Stick the mods inside the roaming directory; but not the .minecraft directory itself.
modsDir = downloadLocation + "\\.minecraft\\"; modsDir = downloadLocation + "\\.minecraft\\";
downloadLocation.append("\\mods.zip"); // Should point to %APPDATA%\mods.zip
} }
#elif __unix__ #elif __unix__
isLinux = true; isLinux = true;
@ -175,7 +174,6 @@ void MainWindow::on_changeInstallPathButton_clicked()
modsDir = directory; modsDir = directory;
} }
qDebug() << "New active .minecraft dir is: " << modsDir;
ui->mcInstallDir->setText(modsDir); ui->mcInstallDir->setText(modsDir);
} }