Skip to content

Commit

Permalink
Fix: logical error
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Jul 14, 2023
1 parent 44ba58e commit c17bea3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bing-wallpaper-macos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) {

if (!checkNetworkConnection(CheckNetworkUrl)) {
cerr << "Failed to connect to destination URL" << endl;
return 0;
return 1;
}

string wallpaperJsonContent = getJsonContent(WallpaperJsonUrl);
Expand All @@ -73,21 +73,20 @@ int main(int argc, char* argv[]) {
// cout << "file download complete" << endl;
} else {
cerr << "Failed to download wallpaper" << endl;
return 0;
return 1;
}

string script = "tell application \"System Events\" to tell every desktop to set picture to \"" + downloadedFilePath + "\"";
int result = runAppleScript(script);
if (result) {
cout << "\033[0m[\033[33m" << getYesterdayDate() << "\033[0m] "
<< "\033[35mWallpaper applied successfully :)" << endl;
updateConfig(ConfigDir, ConfigName);
} else {
cerr << "Failed to apply wallpaper" << endl;
return 0;
return 1;
}

updateConfig(ConfigDir, ConfigName);

return 0;
}

Expand Down

0 comments on commit c17bea3

Please sign in to comment.