Skip to content

Commit

Permalink
fix: temporary directory to return direct path instead of symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
fortmarek committed Feb 5, 2025
1 parent 3d3c635 commit 0ae448a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio",
"state" : {
"revision" : "ba72f31e11275fc5bf060c966cf6c1f36842a291",
"version" : "2.79.0"
"revision" : "dff45738d84a53dbc8ee899c306b3a7227f54f89",
"version" : "2.80.0"
}
},
{
Expand Down
8 changes: 5 additions & 3 deletions Sources/FileSystem/FileSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,11 @@ public struct FileSystem: FileSysteming, Sendable {

/// The path to the directory /var is a symlink to /var/private.
/// NSTemporaryDirectory() returns the path to the symlink, so the logic here removes the symlink from it.
// if systemTemporaryDirectory.starts(with: "/var/") {
// systemTemporaryDirectory = "/private\(systemTemporaryDirectory)"
// }
#if os(macOS)
if systemTemporaryDirectory.starts(with: "/var/") {
systemTemporaryDirectory = "/private\(systemTemporaryDirectory)"
}
#endif
let temporaryDirectory = try AbsolutePath(validating: systemTemporaryDirectory)
.appending(component: "\(prefix)-\(UUID().uuidString)")
logger?.debug("Creating a temporary directory at path \(temporaryDirectory.pathString).")
Expand Down

0 comments on commit 0ae448a

Please sign in to comment.