[Therion] Cross platform clean-up of system commands
Thomas Holder
thomas at thomas-holder.de
Sat Jan 18 18:14:57 CET 2025
I like your "rm.bat" hackaround, I would do the same :)
Thomas
On Sat, Jan 18, 2025 at 10:00 AM Tarquin Wilton-Jones via Therion
<therion at speleo.sk> wrote:
>
> I have a hackaround that basically allows code branching on Windows and
> Linux/Mac from within Therion's system command, so it always clears up
> temp files no matter what the platform is.
>
> Create a file called "rm.bat" in the .thconfig directory. Give it these
> contents:
>
> @echo off
> ::simulate the Linux rm command on Windows, since Therion's "system"
> ::command cannot cope with code branching for platforms
> if "%~2"=="" exit /b
> del "%~2" 2>nul
>
> Then the .thconfig can use this:
> system "rm -f deleteme-temp.pdf"
>
> On Linux, it uses the native "rm" command, and -f means it can silently
> ignore any temp files that didn't get created.
>
> On Windows, it uses rm.bat, and that redirects any error messages to
> nul. So Therion always considers it a success no matter what, and files
> get cleaned up no matter what.
>
> Anyone have anything better?
> (Did anyone cringe from that "solution"?)
>
> Cheers,
>
> Tarquin
> _______________________________________________
> Therion mailing list
> Therion at speleo.sk
> https://mailman.speleo.sk/listinfo/therion
More information about the Therion
mailing list