Home » Developing U++ » U++ Developers corner » evaluate command line (parse line by line processed command to create backup log)
Re: evaluate command line [message #58690 is a reply to message #58689] |
Fri, 22 July 2022 21:48   |
jjacksonRIAB
Messages: 227 Registered: June 2011
|
Experienced Member |
|
|
Yeah dir might not work if you're in an empty directory or the delimiter is not a newline (I think it is even under Windows though). There's a function called
ChangeCurrentDirectory("whatever");
There are also several functions for reading in environment variables that could prove useful to you in certain contexts. Ex.
Cout() << GetEnv("PATH");
Will print out a PATH environment variable in a unix-like or DOS. There's also GetHomeDirectory(), GetProgramsFolder(), GetProgramsFolderX86(), GetTempDirectory() and a few others - I believe all of those call GetEnv with known environment variables.
I don't know anything about MariaDB but it may be preferable to find some kind of environment variable or registry key to locate where mysqldump.exe so your don't have to hardcode anything (knowing Windows it could be installed in one of several places or even on a different drive). Sometimes that can't be helped though... and if it's just for personal use who cares, I guess... but if, for example, someone put their Programs Folder on the D: or E: drive instead of C:, some of the functions above can help you clean up your application discovery process.
**EDIT** Looking at Windows, it appears to do things differently. If I use "cmd /c dir" it will print out and split everything correctly but you might want LocalProcess instead. I don't know offhand how to create this process without creating a Window because I just remembered that dir is not actually a separate program under Windows, it's a built-in shell command. There's probably some argument that be passed to hide the window.
https://www.ultimatepp.org/src$Core$AProcess$en-us.html
[Updated on: Fri, 22 July 2022 23:43] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 14 02:45:16 CEST 2025
Total time taken to generate the page: 0.02436 seconds
|