casualsnek / cassowary

Run Windows Applications on Linux as if they are native, Use linux applications to launch files files located in windows vm without needing to install applications on vm. With easy to use configuration GUI
GNU General Public License v2.0
2.88k stars 75 forks source link

[Feature Request] Allow for choosing root directory for host->guest file sharing? #29

Closed XanderThunder closed 2 years ago

XanderThunder commented 2 years ago

Hi, before requesting the feature, I wanted to say that I totally love your program. It makes using a windows VM so much easier and more integrated. Thank you very much for creating this!!!

Regarding the feature: When exploring the settings of cassowary I noticed that the root directory of the host gets shared no matter what. I guess this is needed since xfreerdp only allows for one shared folder (I might be wrong here). With respect to that, I would like to be able to choose which directory should be the "root" for all other shares. I don't like the idea of my windows vm having access to my root filesystem with all the sensitive data stored on there. So instead of making "/" the root share for all other mappings above I would like to select /mnt/xxx and then be able to just map folders inside /mnt/xxx/* to drive letters. Would this be possible? I honestly don't mind errors appearing when trying to map something outside of /mnt/xxx/.

Cheers!

casualsnek commented 2 years ago

This might require a lot of changes to do!

Host root is shared to ensure that any file on your filesystem can be opened with windows application which a lot of people expect to work without messing up with configurations! I understand why you might not want / to be shared, I will check the code for path translation and see if it is doable without breaking other stuff. If i figure it out i will either share patch files which you can use, or if feasible i will add a option to configure it from GUI on next release !

XanderThunder commented 2 years ago

Well, thanks for the lightning fast reply! I didn't know there was other stuff relying on it. Now I understand why you chose to go that way. Thank you very much for looking into it, I'll be happy to assist with testing.

If you come to the conclusion that selecting another root share breaks a lot of stuff, I also wouldn't mind having an option to disable it completely for now (then I might be able to use the xfreerpd CLI parameters on the first config page to share my folder that way).

casualsnek commented 2 years ago

I think it can be done properly, give me some days and i will add a parameter on config file that you can change ! Although you can't open any file outside of your set root with windows applications !

casualsnek commented 2 years ago

Hello, i have done some work on it and pushed the code changes. Can you install the built files from here: https://ufile.io/f/p5tod

After installing the windows component, you may need to reboot VM, the setting for shared root is on advanced tab.

Waiting for your feedback :)

XanderThunder commented 2 years ago

Hi, thank you sooo much for implementing this so quickly! I tested the main functions of the app in your provided temporary build and nearly everything seemed to work just fine.

Did you intentionally remove the field to provide the folderpath in the "Folder Mappings -> Create New Share" dialog since I said that I was totally fine with it not being there and me doing additional mappings manually instead? If so, then this behaviour is to be expected.

Again, thank you very much for doing this extra work for me and others that might have similar requirements.

Here are a few screenshots of my configuration and the findings of my testing:

image image image image

casualsnek commented 2 years ago

Did you intentionally remove the field to provide the folderpath in the "Folder Mappings -> Create New Share" dialog since I said that I was totally fine with it not being there and me doing additional mappings manually instead? If so, then this behaviour is to be expected.

I guess you are on wrong tab, its for mounting local disk on windows to linux, its mountpoint location is specified on advanced as Windows share mount root ( And you are getting error as expected because local disk A does not exist in VM )

For Linux to windows sharing use linux-> windows sub tab !

XanderThunder commented 2 years ago

You are absolutely right! I mixed up the tabs because in the previous version, the "Linux->Windows" tab was the first one. I guess I did not look closely enough. Sorry for that!

The drive mappings work (after applying the workaround from issue 11). If you tried to map a directory outside of the root share directory you would get an error with a helpful explanation - which works perfectly. And if you afterwards remove a drive mapping in cassowary while Windows is running, the drive becomes inaccessible through explorer. This solves itself by issuing a restart.

Here are (again) my screenshots:

image image image

casualsnek commented 2 years ago

You are absolutely right! I mixed up the tabs because in the previous version, the "Linux->Windows" tab was the first one. I guess I did not look closely enough. Sorry for that!

The drive mappings work (after applying the workaround from issue 11). If you tried to map a directory outside of the root share directory you would get an error with a helpful explanation - which works perfectly. And if you afterwards remove a drive mapping in cassowary while Windows is running, the drive becomes inaccessible through explorer. This solves itself by issuing a restart.

Here are (again) my screenshots:

image image image

You are absolutely right! I mixed up the tabs because in the previous version, the "Linux->Windows" tab was the first one. I guess I did not look closely enough. Sorry for that!

The drive mappings work (after applying the workaround from issue 11). If you tried to map a directory outside of the root share directory you would get an error with a helpful explanation - which works perfectly. And if you afterwards remove a drive mapping in cassowary while Windows is running, the drive becomes inaccessible through explorer. This solves itself by issuing a restart.

Here are (again) my screenshots:

image image image

For https://github.com/casualsnek/cassowary/issues/11#issuecomment-1030866830 this issue, i am pushing a change after few hours that should fix it.

For Drive being inaccessible after removing it in cassowary is expected behavior, although windows explorer does not remove the entry instantly. ( Refreshing can get rid of it ). Thank you for testing and feedback !

casualsnek commented 2 years ago

Do you have any issue remaining with it or is it okay if i close this issue ?

XanderThunder commented 2 years ago

Closing is fine, sorry I forgot to do so ...