Houston4444 / RaySession

Session manager for linux musical programs
GNU General Public License v2.0
168 stars 20 forks source link

Do not preserve the read-only property of the template #129

Closed tobiasBora closed 3 months ago

tobiasBora commented 2 years ago

Fix https://github.com/Houston4444/RaySession/issues/128

Houston4444 commented 2 years ago

Hi. Sorry this is not possible this way. It breaks session scripts because executables are not executable anymore. I am of course open to alternative suggestion.

tobiasBora commented 2 years ago

Arg, did not know that it would remove x flag. Otherwise I guess we can combine the cp with chmod +w. Out of curiosity, why is this nice+cp required? What's wrong with a python-based solution?

Houston4444 commented 2 years ago

Out of curiosity, why is this nice+cp required? What's wrong with a python-based solution?

It is certainly possible to use shutil.copytree (keeping in mind that file_copier can also work on file directly). TBH, I don't remember exactly why I choosed this solution, maybe because it is more simple, because copytree would have to be done from another thread (to preserve the communication with GUI, and because a timer checks and report copy progress to GUI).

tobiasBora commented 2 years ago

Ok thanks. I tried to check how to solve the problem without changing the current code too much, but I'm not even sure why the current code works: self._process.start is started in a loop, and the Qt doc says If the QProcess object is already running a process, a warning may be printed at the console, and the existing process will continue running unaffected.. So if a copy is not finished when the next file is copied, the copy will fail?

Houston4444 commented 2 years ago

loop is broken just after self._process.start. It searches the next file to copy, when found, run the copy (loop is broken). And the _next_process function will be called when this copy is finished. So it is not possible to have two simultaneous copies with the file_copier.

Note that many file_copier instances could exist (rarely), it is the case when user duplicate a non running session (from open session dialog).

Houston4444 commented 2 years ago

Possibility would be to chmod files after copy. The problem is that, there are certainly good reasons for a user to preserve some unwriteable files in a session (or a session template). The most reasonable solution would be to change permissions only when file comes from factory...

Thinking to that, have you the same problem with ray-hack clients ? for example Calf Jack Host or rosegarden, when you add them to the session ? (To see this, you will need to run a session, you can do that creating a session with an empty template, it won't copy files).

I say that because factory client templates are installed in /etc/xdg/ , and not in RaySession code path, and I think to achieve a similar solution for session templates in future.

PowerUser64 commented 3 months ago

This can probably be closed now, #128 has been fixed

Houston4444 commented 3 months ago

Yes, problem has been fixed.