Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public static void applyPatch(String baseBundlePath, String diffPath, boolean is
// Create a temporary directory for the patched bundle
File tempPatchedDir = new File(diffDir.getParent(), diffDir.getName() + "_patched_temp");
try {
// Copy base bundle to temporary location
// Clear any leftover temp dir, then copy base bundle
if (tempPatchedDir.exists()) {
StallionFileManager.deleteFileOrFolderSilently(tempPatchedDir);
}
StallionFileManager.copyDirectory(baseBundleDir, tempPatchedDir);

// Read and parse manifest.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static void stabilizeProd() {
File newSlot = new File(baseFolderPath, StallionConfigConstants.PROD_DIRECTORY + StallionConfigConstants.NEW_FOLDER_SLOT);
File stableSlot = new File(baseFolderPath, StallionConfigConstants.PROD_DIRECTORY + StallionConfigConstants.STABLE_FOLDER_SLOT);

StallionFileManager.deleteFileOrFolderSilently(stableSlot);
StallionFileManager.copyDirectory(newSlot, stableSlot);

String newReleaseHash = stateManager.stallionMeta.getProdNewHash();
Expand Down
5 changes: 4 additions & 1 deletion ios/main/StallionPatchHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class StallionPatchHandler {
}
}

// Copy base bundle to temporary location
// Clear any leftover temp dir, then copy base bundle
if FileManager.default.fileExists(atPath: tempPatchedDir.path) {
try? FileManager.default.removeItem(at: tempPatchedDir)
}
StallionFileManager.copyFileOrDirectory(from: baseBundlePath, to: tempPatchedDir.path)

// Verify copy succeeded
Expand Down
9 changes: 5 additions & 4 deletions ios/main/StallionSlotManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ + (void)fallbackProd {
StallionStateManager *stateManager = [StallionStateManager sharedInstance];
NSString *baseFolderPath = stateManager.stallionConfig.filesDirectory;

[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@%@%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.new_folder_slot]];
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@%@%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.stable_folder_slot]];
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@%@%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.temp_folder_slot]];
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.new_folder_slot]];
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.stable_folder_slot]];
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.temp_folder_slot]];

[stateManager clearStallionMeta];
}
Expand All @@ -74,7 +74,8 @@ + (void)stabilizeProd {
NSString *newSlotPath = [NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.new_folder_slot];
NSString *stableSlotPath = [NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.stable_folder_slot];

[StallionFileManager moveFileFrom:newSlotPath to:stableSlotPath];
[StallionFileManager deleteFileOrFolderSilently:stableSlotPath];
[StallionFileManager copyFileOrDirectoryFrom:newSlotPath to:stableSlotPath];

NSString *newReleaseHash = stateManager.stallionMeta.prodNewHash;
[stateManager.stallionMeta setProdStableHash:newReleaseHash];
Expand Down