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

[FEATURE] Always copy #115

Open
victorbnl opened this issue Feb 12, 2023 · 6 comments
Open

[FEATURE] Always copy #115

victorbnl opened this issue Feb 12, 2023 · 6 comments

Comments

@victorbnl
Copy link

Is your feature request related to a problem? Please describe.

It would be nice to be able to just always copy the files instead of symlinking.

Describe the solution you'd like

I think that with dotter's current architecture, the most sensible parameter would be a --copy command-line flag

Describe alternatives you've considered

A technically working (well, not even, see #77) solution would be to add the "template" type to all files. It goes without saying this is not a viable solution.

@SuperCuber
Copy link
Owner

Could you tell more about the use case?

@victorbnl
Copy link
Author

I think this is a basic feature and I don't know if the use case is relevant but sure!

Well in my case it has to do with #77; I have files to put in root directories (sddm config), and symlinking it to a user directory is a bit odd. As mentionned I don't want to add the template type to the file, I'd like to keep the config simple.

Plus, I just don't like having a mix of symlinks and copies on my system, I'd rather just copy all files.

@JP-Ellis
Copy link

JP-Ellis commented Apr 4, 2023

Another use case for this feature would be for people on Windows. While Windows (through Developer Mode) does support symbolic links, these are not well supported by other applications. Most notably here is One Drive which simply hangs indefinitely when it encounters a symbolic link.

I noticed that there's already logic to switch to copy-only mode if symbolic links are disabled:

dotter/src/deploy.rs

Lines 66 to 78 in 1e649ab

// On Windows, you need developer mode to create symlinks.
let symlinks_enabled = if filesystem::symlinks_enabled(&PathBuf::from("DOTTER_SYMLINK_TEST"))
.context("check whether symlinks are enabled")?
{
true
} else {
warn!(
"No permission to create symbolic links.\n
On Windows, in order to create symbolic links you need to enable Developer Mode.\n
Proceeding by copying instead of symlinking."
);
false
};

Would be it possible to leverage that with a --copy command line parameter, or the ability to customise a windows.toml file so that all files are copied over?

@SuperCuber
Copy link
Owner

Yes that would work. However there are two problems left:

  • It's probably annoying to specify --copy each time, so it would be better to specify it in local.toml or an include. Maybe a new section for [settings]
  • If you have non utf8 files then they cannot be templated. The "copy target type" feature would solve that, but I don't have the bandwidth to add it

@JP-Ellis
Copy link

JP-Ellis commented Apr 6, 2023

I agree that using --copy all the time would be annoying.

I note there already are ways of having OS-specific configuration which get imported as part of the local.toml definition. I think using this so that on Windows I can have copy = True would be already great.

@victorbnl
Copy link
Author

To me, both would do the job

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

No branches or pull requests

3 participants