Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix temporary directory creation to avoid failing pkl-core tests #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HT154
Copy link

@HT154 HT154 commented Oct 11, 2024

Before this change, pkl-swift's tests (and pkl-gen-swift) write to the root of the user's temporary directory. This causes problems for some tests in pkl-core that rely on not finding a PklProject in any parent directory.

Copy link
Contributor

@holzensp holzensp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing with

/root/project/Sources/PklSwift/Utils.swift:90:106: error: incorrect argument label in call (have 'filePath:', expected 'string:')
    (try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(filePath: "/")!, create: true)).absoluteString
                                                                                                         ^~~~~~~~~
                                                                                                          string

Other than that; LGTM

Comment on lines 89 to 90
public func tempDir() throws -> String {
(try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(filePath: "/")!, create: true)).absoluteString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be inclined to let tempDir() return a URL, considering all the uses, but it's non-blocking.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants