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

Need access to OS specific PATH_SEPARATOR #138505

Closed
calebdw opened this issue Mar 14, 2025 · 3 comments
Closed

Need access to OS specific PATH_SEPARATOR #138505

calebdw opened this issue Mar 14, 2025 · 3 comments
Labels
needs-acp This change is blocked on the author creating an ACP. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@calebdw
Copy link

calebdw commented Mar 14, 2025

Hello!

I need access to the PATH_SEPARATOR constant that contains the OS specific PATH separator used by std::env::split_paths:

cfg_if::cfg_if! {
if #[cfg(target_os = "redox")] {
const PATH_SEPARATOR: u8 = b';';
} else {
const PATH_SEPARATOR: u8 = b':';
}
}

It would be great if this could be exposed similarly to the MAIN_SEPARATOR{,_PATH} constants:

/// The primary separator of path components for the current platform.
///
/// For example, `/` on Unix and `\` on Windows.
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "path_main_separator")]
pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
/// The primary separator of path components for the current platform.
///
/// For example, `/` on Unix and `\` on Windows.
#[stable(feature = "main_separator_str", since = "1.68.0")]
pub const MAIN_SEPARATOR_STR: &str = crate::sys::path::MAIN_SEP_STR;

Thanks!

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 14, 2025
@lolbinarycat lolbinarycat added needs-acp This change is blocked on the author creating an ACP. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Mar 14, 2025
@lolbinarycat
Copy link
Contributor

I believe this would need to be an ACP

@calebdw
Copy link
Author

calebdw commented Mar 14, 2025

Turns out I can just use std::env::join_paths instead of manually doing it myself---however, exposing the constants might still be useful (otherwise feel free to close this)

@lolbinarycat
Copy link
Contributor

Exposing this would require a compelling usecase, which has not been presented. Even if a compelling usecase is found, it should be presented in the form of an ACP, not here, so I'm closing this.

@lolbinarycat lolbinarycat closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2025
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-acp This change is blocked on the author creating an ACP. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants