Skip to content

Commit

Permalink
bug fix #7
Browse files Browse the repository at this point in the history
  • Loading branch information
underthestars-zhy committed Nov 14, 2022
1 parent 5d6b24f commit 5e6fa31
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
14 changes: 7 additions & 7 deletions IconChanger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 13;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"IconChanger/Preview Content\"";
DEVELOPMENT_TEAM = 44BN78992X;
Expand All @@ -395,8 +395,8 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.2.3;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.zhuhaoyu.IconChanger;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -414,7 +414,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 13;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"IconChanger/Preview Content\"";
DEVELOPMENT_TEAM = 44BN78992X;
Expand All @@ -428,8 +428,8 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.2.3;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.zhuhaoyu.IconChanger;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -483,7 +483,7 @@
repositoryURL = "https://github.com/underthestars-zhy/LaunchPadManagerDBHelper";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 1.0.8;
minimumVersion = 1.0.9;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
6 changes: 1 addition & 5 deletions IconChanger/IconManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ class IconManager: ObservableObject {
let copy = content

for (key, value) in replacement {
if #available(macOS 13.0, *) {
content.replace("%\(key)", with: value)
} else {
content = content.replace(target: "%\(key)", withString: value)
}
content = content.replace(target: "%\(key)", withString: value)
}

try content.write(to: path, atomically: true, encoding: .utf8)
Expand Down
18 changes: 3 additions & 15 deletions IconChanger/URL+Universal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,14 @@ import Foundation

extension URL {
func universalappending(path: String) -> Self {
if #available(macOS 13, *) {
return self.appending(component: path)
} else {
return self.appendingPathComponent(path)
}
return self.appendingPathComponent(path)
}

func universalPath() -> String {
if #available(macOS 13, *) {
return self.path().removingPercentEncoding ?? self.path()
} else {
return self.path.removingPercentEncoding ?? self.path
}
return self.path.removingPercentEncoding ?? self.path
}

init(universalFilePath: String) {
if #available(macOS 13, *) {
self.init(filePath: universalFilePath)
} else {
self.init(fileURLWithPath: universalFilePath)
}
self.init(fileURLWithPath: universalFilePath)
}
}

0 comments on commit 5e6fa31

Please sign in to comment.