Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Detect if there's custom settings that need to be migrated.
Browse files Browse the repository at this point in the history
  • Loading branch information
cormiertyshawn895 committed Jan 19, 2020
1 parent bf25fcf commit 8fa97ed
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Retroactive.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@
CODE_SIGN_ENTITLEMENTS = Retroactive/Support/Retroactive.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 15;
CURRENT_PROJECT_VERSION = 16;
INFOPLIST_FILE = Retroactive/Support/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -623,7 +623,7 @@
CODE_SIGN_ENTITLEMENTS = Retroactive/Support/Retroactive.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 15;
CURRENT_PROJECT_VERSION = 16;
INFOPLIST_FILE = Retroactive/Support/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
2 changes: 2 additions & 0 deletions Retroactive/AppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ let systemNameToken = "{systemName}"
let purposeToken = "{purpose}"
let actionPresentTenseToken = "{actionPR}"

let kCustomSettingsPath = "/Library/Application Support/Final Cut Pro System Support/Custom Settings"

extension Bundle {
var cfBundleVersionInt: Int? {
get {
Expand Down
16 changes: 16 additions & 0 deletions Retroactive/StepOne/AppFinder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ class AppFinder: NSObject {
}
}
}
} else if AppManager.shared.chosenApp == .finalCutPro7 {
do {
let exists = FileManager.default.fileExists(atPath: kCustomSettingsPath)
if (!exists) {
self.pushCompletionVC()
return
}
let contents = try FileManager.default.contentsOfDirectory(atPath: kCustomSettingsPath)
let presets = contents.filter { $0.lowercased().hasSuffix(".fcpre") }
if (presets.count == 0) {
self.pushCompletionVC()
return
}
} catch {
print("Can't determine if custom settings exist \(error)")
}
} else {
self.pushCompletionVC()
return
Expand Down
4 changes: 2 additions & 2 deletions Retroactive/StepThree/ProgressViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ProgressViewController: NSViewController, URLSessionDelegate, URLSessionDa
let kBrowserKitCopyPath = "\(kLibraryFrameworkPath)/BrowserKit.framework"
let kProKitCopyPath = "\(kLibraryFrameworkPath)/ProKit.framework"
let kAudioToolboxCopyPath = "\(appPath)/Contents/Frameworks/AudioToolbox.framework"
let kCustomSettingsPath = "/Library/Application Support/Final Cut Pro System Support/Custom Settings".fileSystemString
let fsCustomSettingsPath = kCustomSettingsPath.fileSystemString

if (fullMode == true) {
// It shouldn't be possible to have ProKit or BrowserKit at /System/Library/Frameworks on High Sierra or Mojave, and deleting them will fail with SIP.
Expand Down Expand Up @@ -233,7 +233,7 @@ class ProgressViewController: NSViewController, URLSessionDelegate, URLSessionDa
self.runTask(toolPath: "/usr/bin/plutil", arguments: ["-replace", kCFBundleVersion, "-string", AppManager.shared.patchedVersionStringOfChosenApp, "Contents/Info.plist"])

// Having custom settings will hang Final Cut Pro at launch, let's delete it.
self.runTask(toolPath: "/bin/rm", arguments: ["-rf", kCustomSettingsPath])
self.runTask(toolPath: "/bin/rm", arguments: ["-rf", fsCustomSettingsPath])

self.stage4Started()
self.runTask(toolPath: "/usr/bin/codesign", arguments: ["-fs", "-", appPath, "--deep"])
Expand Down
2 changes: 1 addition & 1 deletion Retroactive/Support/SupportPath.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>LatestZIP</key>
<string>https://github.com/cormiertyshawn895/Retroactive/releases/download/1.4/Retroactive.1.4.zip</string>
<key>LatestBuildNumber</key>
<integer>15</integer>
<integer>16</integer>
<key>SupportPathURL</key>
<string>https://raw.githubusercontent.com/cormiertyshawn895/Retroactive/master/Retroactive/Support/SupportPath.plist</string>
<key>ReleasePage</key>
Expand Down

0 comments on commit 8fa97ed

Please sign in to comment.