You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2026/03/19 22:37:29 UTC

(spark-connect-swift) branch main updated: [SPARK-56086] Use `URL.homeDirectory` for iOS

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-connect-swift.git


The following commit(s) were added to refs/heads/main by this push:
     new 5885ace  [SPARK-56086] Use `URL.homeDirectory` for iOS
5885ace is described below

commit 5885aced0e4b563f38145e566faeb5c5516655f8
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Thu Mar 19 15:37:23 2026 -0700

    [SPARK-56086] Use `URL.homeDirectory` for iOS
    
    ### What changes were proposed in this pull request?
    
    This PR replaces `FileManager.default.homeDirectoryForCurrentUser` with `URL.homeDirectory` in `SparkFileUtils.expandingTildeInPath`.
    
    ### Why are the changes needed?
    
    `FileManager.default.homeDirectoryForCurrentUser` is not available on iOS. `URL.homeDirectory` works across all platforms including iOS.
    
    ```swift
    $ swift repl
    Welcome to Apple Swift version 6.2.3 (swiftlang-6.2.3.3.21 clang-1700.6.3.2).
    Type :help for assistance.
      1> import Foundation
      2> URL.homeDirectory.path
    $R0: String = "/Users/dongjoon"
    ```
    
    Currently, the Swift Package Index CI is broken.
    
    - https://swiftpackageindex.com/apache/spark-connect-swift/builds
    
    <img width="856" height="465" alt="Screenshot 2026-03-19 at 14 45 19" src="https://github.com/user-attachments/assets/c9a039e8-bcd6-4d3b-907d-9a187761ab3d" />
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Pass the existing CI with the updated `SparkFileUtilsTests`.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (claude-opus-4-6)
    
    Closes #325 from dongjoon-hyun/SPARK-56086.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 Sources/SparkConnect/SparkFileUtils.swift         | 2 +-
 Tests/SparkConnectTests/SparkFileUtilsTests.swift | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Sources/SparkConnect/SparkFileUtils.swift b/Sources/SparkConnect/SparkFileUtils.swift
index 0b62a02..1e81028 100644
--- a/Sources/SparkConnect/SparkFileUtils.swift
+++ b/Sources/SparkConnect/SparkFileUtils.swift
@@ -53,7 +53,7 @@ public enum SparkFileUtils {
 
   private static func expandingTildeInPath(_ path: String) -> String {
     guard path.hasPrefix("~") else { return path }
-    let homeDir = FileManager.default.homeDirectoryForCurrentUser.path
+    let homeDir = URL.homeDirectory.path
     if path == "~" {
       return homeDir
     }
diff --git a/Tests/SparkConnectTests/SparkFileUtilsTests.swift b/Tests/SparkConnectTests/SparkFileUtilsTests.swift
index e9ff747..c0b5c83 100644
--- a/Tests/SparkConnectTests/SparkFileUtilsTests.swift
+++ b/Tests/SparkConnectTests/SparkFileUtilsTests.swift
@@ -37,7 +37,8 @@ struct SparkFileUtilsTests {
     #expect(fileNameURL!.absoluteString == "file://\(fm.currentDirectoryPath)/jar1")
 
     let homeUrl = SparkFileUtils.resolveURL("~/jar1")
-    #expect(homeUrl!.absoluteString == "\(fm.homeDirectoryForCurrentUser.absoluteString)jar1")
+    let homeDir = URL.homeDirectory.absoluteString
+    #expect(homeUrl!.absoluteString == "\(homeDir)jar1")
 
     let absolutePath = SparkFileUtils.resolveURL("file:/jar1")
     #expect(absolutePath!.absoluteString == "file:/jar1")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org