Add CurrentDirectory to JclSysUtils.Execute#79
Add CurrentDirectory to JclSysUtils.Execute#79silverqx wants to merge 1 commit intoproject-jedi:masterfrom
Conversation
|
Hello, Thank you for this pull request. As I read it, the code changes are only valid for a Windows target. This means that the new function parameter has no impact when compiling for Linux (with FPC) and thus gives a false sense that it would serve a purpose. |
|
You are right, I did it this way, but I changed it right before I sent this PR 🤔, I don't even why. I change it back, like you are proposing and send an update later. |
CurrentDirectory parameter is passed to the CreateProcess Windows function
659003c to
a585199
Compare
|
Done, I moved |
|
Thanks for that, but this does not addresss my remark about the new parameter you added to all functions. With the current code, it won't compile for LINUX. Sure, you could add a |
|
It will compile in Linux env. without any problems, the parameter has default value |
|
If you look at all |
|
Changing the current directory of a new process should be implemented under Linux. |
The
CurrentDirectoryparameter is passed down to theCreateProcessWindows function as thelpCurrentDirectoryparameter.I decided to add this parameter as the last parameter to all
JclSysUtils.Executefunctions with a default value '' ( empty string ).I added
PCurrentDirectory: PCharinsideJclSysUtils.ExecuteCmdProcessfunction, because ifCurrentDirectoryis empty string,nilhave to be passed down to theCreateProcess, in this case, the new process will have the same current drive and directory as the calling process.This PR is backward compatible, doesn't contain any breaking changes. 🤓