Skip to content

Commit

Permalink
Ensure critical dirs exist before starting guest app
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Apr 25, 2024
1 parent a463511 commit 6d30758
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ static void overwriteExecPath(NSString *bundlePath) {
setenv("HOME", newHomePath.UTF8String, 1);
setenv("TMPDIR", [@(getenv("TMPDIR")) stringByAppendingFormat:@"/%@/tmp", appBundle.infoDictionary[@"LCDataUUID"]].UTF8String, 1);
// Setup directories
NSString *cachePath = [NSString stringWithFormat:@"%@/Library/Caches", newHomePath];
[fm createDirectoryAtPath:cachePath withIntermediateDirectories:YES attributes:nil error:nil];
NSArray *dirList = @[@"Library/Caches", @"Documents", @"SystemData"];
for (NSString *dir in dirList) {
NSString *dirPath = [newHomePath stringByAppendingPathComponent:dir];
[fm createDirectoryAtPath:dirPath withIntermediateDirectories:YES attributes:nil error:nil];
}

// Preload executable to bypass RT_NOLOAD
uint32_t appIndex = _dyld_image_count();
Expand Down

0 comments on commit 6d30758

Please sign in to comment.