AviSynth / AviSynthPlus

AviSynth with improvements
http://avs-plus.net
956 stars 72 forks source link

Feature request: Integrate GetSystemEnv into the core #28

Open qyot27 opened 10 years ago

qyot27 commented 10 years ago

Or at least something that provides same/similar functionality, if the code involved is not up to snuff.

Binary/source: http://www.avisynth.nl/users/stickboy/

It appears to be under the 2-clause BSD License.

tp7 commented 10 years ago

Usecase? Also, what would be the benefits of having this in the core?

qyot27 commented 10 years ago

Well, the reason years ago that I came across it had to do with being able to change or report the script's current working directory - I think it had something to do with getting around a weird path-related bug in mencoder (when I still used mencoder).

But being able to point at a file in %HOME% (for example) and have a mechanism to allow it to be expanded out to whatever the system has it set to is probably more valuable in the long run. There could also be other types of information that the user could glean from the system variables that might be relevant to set up conditional filtering. That description probably doesn't explicitly need a 'GetSystemEnv' filter (and actually, I can't seem to get GetSystemEnv to do exactly what I'm describing here because there doesn't seem to be any [easy?] way to append/concatenate strings) but the basic idea is sort of the same.

tp7 commented 10 years ago

There's the SetWorkingDir function that allows the user to change the cwd.

As for environment variables - I'm not sure it's useful and should be included in the core. The only obvious use case I see where this could be useful is various GUIs/script generators, but those usually generate scripts themselves and can expand whatever variables they need. It's not hard to implement but I don't see any value of having it in the core.

And yes, current string concatenation/formatting ways are a bit unusable for stuff like this. You can work around it with something like this script but it's sub-optimal and breaks avspmod right now. We probably should add a sane function to the core.