Skip to content

Commit

Permalink
[Launcher] Delete addonStartup.json.lz4 before launching the executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Betterbird committed Jul 5, 2022
1 parent 1c32f11 commit 87ae2b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Binary file modified BetterbirdLauncher/BetterbirdLauncher.exe
Binary file not shown.
17 changes: 15 additions & 2 deletions BetterbirdLauncher/BetterbirdLauncher/BetterbirdLauncher.cpp
@@ -1,10 +1,13 @@
#include <shlobj.h>
#include <shlwapi.h>
#include <objbase.h>
#include <windows.h>
#include <stdio.h>
#define MAX_PATH_PROFILE MAX_PATH + 50

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) {
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
TCHAR appPath[MAX_PATH];
TCHAR cacheFile[MAX_PATH];
TCHAR profilePath[MAX_PATH_PROFILE];
SHELLEXECUTEINFO ShExecInfo;

Expand All @@ -14,11 +17,21 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
*lastSlash = 0;

// Prepare profile folder path.
wcscpy_s(profilePath, appPath);
wcscpy_s(profilePath, L"-new-instance -profile \"");
wcscat_s(profilePath, MAX_PATH_PROFILE, appPath);
wcscat_s(profilePath, MAX_PATH_PROFILE, L"\\profile\"");

// Path to the cache file we want to delete.
wcscpy_s(cacheFile, appPath);
wcscat_s(cacheFile, MAX_PATH_PROFILE, L"\\profile\\addonStartup.json.lz4");
bool res = DeleteFileW(cacheFile);
#if 0
DWORD err = GetLastError();
char msg[MAX_PATH + 100];
sprintf_s(msg, sizeof(msg), "BetterbirdLauncher: Deleted %S with success %d %lx\n", cacheFile, res, err);
OutputDebugStringA(msg);
#endif

// Add executable.
wcscat_s(appPath, MAX_PATH, L"\\core\\betterbird.exe");

Expand Down

0 comments on commit 87ae2b0

Please sign in to comment.