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

func FilesFromDisk filenames arg, if path seperator is not system defined, pathInArchieve may be wrong path #382

Open
mind-owner opened this issue Aug 21, 2023 · 7 comments

Comments

@mind-owner
Copy link

What version of the package or command are you using?

What are you trying to do?

What steps did you take?

What did you expect to happen, and what actually happened instead?

How do you think this should be fixed?

Please link to any related issues, pull requests, and/or discussion

Bonus: What do you use archiver for, and do you find it useful?

@mind-owner
Copy link
Author

	map[string]string{
		"disk/folder2":             "CF", // contents added recursively
	})

I want disk/folder2/a.txt to be CF/a.txt,but it's CF/disk/folder2/a.txt, in windows

@mholt
Copy link
Owner

mholt commented Aug 21, 2023

Thanks, I'll look into this (but I don't use Windows so I'll ask for your help to verify)

@mholt
Copy link
Owner

mholt commented Aug 21, 2023

Ok so I just looked at the tests and this is expected. What happens if you specify disk/folder2/ or CF/ instead? (It's been a long time since I've looked at this code, but I'm pretty sure what you're asking for can be done. I just don't remember how, and probably need to improve the docs.)

@mind-owner
Copy link
Author

mind-owner commented Aug 21, 2023 via email

@mholt
Copy link
Owner

mholt commented Aug 21, 2023

@mind-owner You mean disk/folder2 -> disk\folder2?

If that works for you on Windows then I suggest using that 🤷‍♂️ -- nothing needs to be fixed. (We're already using filepath.* function which do account for path separators.)

@mind-owner
Copy link
Author

mind-owner commented Aug 21, 2023 via email

@mholt
Copy link
Owner

mholt commented Sep 7, 2023

@mind-owner If you call filepath.FromSlash() when making your map keys, does that solve it for you in a more cross-platform way? I feel like that would be the most correct solution. (I could be wrong, but not sure yet.)

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

2 participants