Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Aug 13, 2024
1 parent 99b0c31 commit 0b42688
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,16 @@ static void overwriteExecPath(NSString *bundlePath) {
NSProcessInfo.processInfo.processName = appBundle.infoDictionary[@"CFBundleExecutable"];
*_CFGetProgname() = NSProcessInfo.processInfo.processName.UTF8String;

// Overwrite home path
// Overwrite home and tmp path
NSString *newHomePath = [NSString stringWithFormat:@"%@/Data/Application/%@", docPath, appBundle.infoDictionary[@"LCDataUUID"]];
NSString *newTmpPath = [newHomePath stringByAppendingPathComponent:@"tmp"];
remove(newTmpPath.UTF8String);
symlink(getenv("TMPDIR"), newTmpPath.UTF8String);

setenv("CFFIXED_USER_HOME", newHomePath.UTF8String, 1);
setenv("HOME", newHomePath.UTF8String, 1);
setenv("TMPDIR", [@(getenv("TMPDIR")) stringByAppendingFormat:@"%@/tmp/", appBundle.infoDictionary[@"LCDataUUID"]].UTF8String, 1);
setenv("TMPDIR", newTmpPath.UTF8String, 1);

// Setup directories
NSArray *dirList = @[@"Library/Caches", @"Documents", @"SystemData"];
for (NSString *dir in dirList) {
Expand Down

0 comments on commit 0b42688

Please sign in to comment.