Skip to content

Conversation

@shawnhyam
Copy link
Contributor

Should fix #694.

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

I don't know what a root-only file: URL like C:/ on Windows looks like and I don't have a good way to test it. @compnerd does this look reasonable to you?

@compnerd
Copy link
Member

compnerd commented Sep 4, 2024

I think that it depends on what you are using. Particularly with swift-foundation, it should be /[A-Z]:/, unless you do the correct thing and use withFileSystemRepresentation, in which case it would be [A-Z]:\.

return candidateFile
}
} while candidateDirectory.path != "/"
} while candidateDirectory.pathComponents.count > 1
Copy link
Member

Choose a reason for hiding this comment

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

The concern that I have with this on Windows is that this would return true for C: and \, both of which are relative paths.

@allevato allevato requested a review from compnerd September 5, 2024 14:59
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

This seems generic enough to work. It is unfortunate that Foundation doesn't have a isRoot property.

@allevato allevato merged commit a1ee216 into swiftlang:main Sep 6, 2024
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 10, 2024
…'t contain a `.swift-format` file

swiftlang#802 this sort of infinite looping issue on Windows but introduced it on Unix platforms where `URL.deletingLastPathComponent` on `/` returns `/..`.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 10, 2024
…'t contain a `.swift-format` file

swiftlang#802 this sort of infinite looping issue on Windows but introduced it on Unix platforms where `URL.deletingLastPathComponent` on `/` returns `/..`.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 11, 2024
…'t contain a `.swift-format` file

swiftlang#802 this sort of infinite looping issue on Windows but introduced it on Unix platforms where `URL.deletingLastPathComponent` on `/` returns `/..`.

# Conflicts:
#	Sources/SwiftFormat/API/Configuration.swift
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 11, 2024
…'t contain a `.swift-format` file

swiftlang#802 this sort of infinite looping issue on Windows but introduced it on Unix platforms where `URL.deletingLastPathComponent` on `/` returns `/..`.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 11, 2024
…'t contain a `.swift-format` file

swiftlang#802 this sort of infinite looping issue on Windows but introduced it on Unix platforms where `URL.deletingLastPathComponent` on `/` returns `/..`.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 11, 2024
…'t contain a `.swift-format` file

swiftlang#802 this sort of infinite looping issue on Windows but introduced it on Unix platforms where `URL.deletingLastPathComponent` on `/` returns `/..`.
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.

Formatting not working on Windows

3 participants