Skip to content

Commit

Permalink
Merge pull request #17 from jamf/1.3.2-changes
Browse files Browse the repository at this point in the history
Fixed an issue where it would fail to copy a file from a JCDS DP to a…
  • Loading branch information
HarryStrandJamf authored Jul 3, 2024
2 parents c7cbffa + ed4c7c0 commit 029a60a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.2] - 2024-07-02
### Bug fixes
- Fixed an issue where it would fail to copy a file from a JCDS DP to a file share DP.

## [1.3.1] - 2024-06-25
### Bug fixes
- Fixed an issue where some package fields for packages on the server would be overwritten with default values when packages were updated.
Expand Down
4 changes: 2 additions & 2 deletions Jamf Sync.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.jamfsync;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -857,7 +857,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.jamfsync;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
"revision" : "ee97538f5b81ae89698fd95938896dec5217b148",
"version" : "1.1.1"
}
}
],
Expand Down
15 changes: 11 additions & 4 deletions JamfSync/Utility/FileManager+moveRetainingPermissions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import Foundation
extension FileManager {
func moveRetainingDestinationPermisssions(at srcURL: URL, to dstURL: URL) throws {
try "Placeholder file with permissions of containing directory".write(to: dstURL, atomically: false, encoding: .utf8)
if let result = try self.replaceItemAt(dstURL, withItemAt: srcURL), result.path() != dstURL.path() {
// This probably can't happen, but if it does, we should know about it.
LogManager.shared.logMessage(message: "When moving \(srcURL.path) to \(dstURL.path), the file name was changed to \(result.path)", level: .warning)
do {
if let result = try self.replaceItemAt(dstURL, withItemAt: srcURL), result.path() != dstURL.path() {
// This probably can't happen, but if it does, we should know about it.
LogManager.shared.logMessage(message: "When moving \(srcURL.path) to \(dstURL.path), the file name was changed to \(result.path)", level: .warning)
}
} catch {
// The above only works when it is a local folder and not a file share. So just copy the file in that case.
try? self.removeItem(at: dstURL)
try self.copyItem(at: srcURL, to: dstURL)
}

// The replaceItemAt function seems to move the original file, but the name and documentation for the function
// doesn't imply that so we'll attempt to remove the file but ignore any errors.
// doesn't imply that so we'll attempt to remove the file but ignore any errors. Also, the copyItem function does
// not delete it.
try? self.removeItem(at: srcURL)
}
}

0 comments on commit 029a60a

Please sign in to comment.