hasse69 / rar2fs

FUSE file system for reading RAR archives
https://hasse69.github.io/rar2fs/
GNU General Public License v3.0
272 stars 25 forks source link

Option to be able to flatten folder structure #148

Closed karibertils closed 3 years ago

karibertils commented 3 years ago

Sometimes rar archives contain some folder structure causing trouble. Usually this seems to be mistake by whoever made the archive by accidentally adding the whole folder structure to the archive.

Stuff like C:/Users/Someone/Desktop/Example/example.mkv or other multiple paths a/b/c/d/e/ added that have nothing to do with the content. In these cases I have encountered software having problems working with media files when they are in structure like this and need to extract and move the file to get it working.

A nice workaround would be to have an option to remove the folder structure altogether so all files show up in the root folder containing the archive.

hasse69 commented 3 years ago

If there are applications that cannot work properly due to a certain file hierarchy you should file an issue report towards those applications directly. This is not an issue with rar2fs and it would also not be the appropriate place to solve it. If there is a need to flatten the file hierarchy some other files system should solve such a task instead, even though I would be rather surprised if there are any due to problems with e.g. file name collision etc.

hasse69 commented 3 years ago

If I can come with a suggestion here, the "flattening" is something you could take care of yourself using some script magic and soft links. Since you are the only person that has full control and knowledge of your own file library, I think it would be rather simple to write some script that simply does a recursive scan of your mount point and creates soft links pointing directly to each file you are interested in. Thus by-passing any underlying directory structures. You could then point whatever application you use to this new directory of yours that is only sitting on a lot of soft links. Of course this script would then have to be executed each time the contents of your library was changed/updated.

karibertils commented 3 years ago

I'm already maintaining symlinks for cases like this. I was just thinking this could be easily and transparently accomplished within rar2fs because it's already an abstraction layer to the filesystem. 95% of the time there's no extra paths and filenames are good enough for all software to work nicely, but then there's always these odd cases here and there where you need to use symlinks or extract/rename etc.

But anyway, I understand your reasoning that rar2fs is not the appropriate place to do this so that's that.