Open mind-owner opened 1 year ago
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
Thanks, I'll look into this (but I don't use Windows so I'll ask for your help to verify)
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.)
in windows the seperator is \,if l use / in filenames arg,it will not work as I want, maybe you can turn \ to / in arg to return the right path
---Original--- From: "Matt @.> Date: Mon, Aug 21, 2023 21:37 PM To: @.>; Cc: @.**@.>; Subject: Re: [mholt/archiver] func FilesFromDisk filenames arg, if pathseperator is not system defined, pathInArchieve may be wrong path (Issue #382)
Ok so I just looked at the tests and this is expected. What happens if you specify CF/ instead?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
@mind-owner You mean disk/folder2
-> disk\folder2
?
If that works for you on Windows then I suggest using that :man_shrugging: -- nothing needs to be fixed. (We're already using filepath.*
function which do account for path separators.)
yes, you are right. I can use \ in windows to return the right path. and usually people would only use / as the path seperator in any system(linux,windows etc), l hope the func FilesFromDisk can support this feature, then l don't need to mention / or \, thanks.
---Original--- From: "Matt @.> Date: Tue, Aug 22, 2023 00:07 AM To: @.>; Cc: @.**@.>; Subject: Re: [mholt/archiver] func FilesFromDisk filenames arg, if pathseperator is not system defined, pathInArchieve may be wrong path (Issue #382)
@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.)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@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.)
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?