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

Use alternatives to symlinks on Windows #82

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

ljoy913
Copy link
Collaborator

@ljoy913 ljoy913 commented Dec 11, 2024

On Windows,
replace directory symlinks with Junctions (junctions are only for directories and require no special privileges)
replace file symlinks with hard-links (hard links are only for files and require no special privileges)

@ljoy913 ljoy913 marked this pull request as ready for review December 11, 2024 23:44
@@ -59,11 +59,17 @@ pub fn cred_type_from_schema(schema_uid : &str) -> Result<&'static str, &'static
use std::os::unix::fs::symlink as symlink_any;

#[cfg(windows)]
use junction;
Copy link
Collaborator

Choose a reason for hiding this comment

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

By adding use junction; here, the cfg(windows) is no longer applied to symlink_any. (these cfg macros only apply to one line, they aren't blocks. I suggest moving the use junction line back up to the top of the file, with it's own conditional macro.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(the problem is on linux cargo tries to build symlink_any, which fails)

@@ -59,11 +59,17 @@ pub fn cred_type_from_schema(schema_uid : &str) -> Result<&'static str, &'static
use std::os::unix::fs::symlink as symlink_any;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also could you move lines 58-59 to the top of the file at the same time, thanks.

@ljoy913 ljoy913 requested a review from zaverucha December 12, 2024 00:20
Signed-off-by: Greg Zaverucha <gregz@microsoft.com>
@ljoy913 ljoy913 merged commit a0a140f into main Dec 12, 2024
3 checks passed
@christianpaquin christianpaquin deleted the crescent-credentials-symlink-fix branch December 12, 2024 20:30
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.

3 participants