Skip to content

Fix ProcessInfo.processName for Windows #839

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

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Sources/FoundationEssentials/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ package struct Platform {
_pageSize
}

// FIXME: Windows SEPARATOR
static let PATH_SEPARATOR: Character = "/"
static let MAX_HOSTNAME_LENGTH = 1024

static func roundDownToMultipleOfPageSize(_ size: Int) -> Int {
Expand Down
8 changes: 1 addition & 7 deletions Sources/FoundationEssentials/ProcessInfo/ProcessInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,7 @@ extension _ProcessInfo {
guard let processPath = CommandLine.arguments.first else {
return ""
}

if let lastSlash = processPath.lastIndex(of: Platform.PATH_SEPARATOR) {
return String(processPath[
processPath.index(after: lastSlash) ..< processPath.endIndex])
}

return processPath
return processPath.lastPathComponent
}

#if os(macOS)
Expand Down