Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cross platform compatible lua scripts
#1
How would one go about the concept of a single lua script working with all supported platforms when dealing with the filesystems? When absolute paths become involved, how does one distinguish from the script, which OS Mixbus is running on in order to use the correct PATH? Sorry for the stupid question, but I had decided to attempt to write a lua script for MP3 import/export. Once I started thinking about it, the PATHs became a concern.
ASUS M5A99FX PRO R2.0 w/AMD FX™-8350 Eight-Core Processor 32GB RAM
M-Audio Delta 1010 / Echo AudioFire 12
Mixbus v7.x on Fedora 33 64bit
Reply
#2
Luckily, scripts are editable by the user. So you could make a variable like: path_to_my_files="/path/to/the/files" and the user would have to edit the script to match their needs.
Reply
#3
ARDOUR.LuaAPI.build_filename (Session:path(), ....) will create a absolute filename relative to the session-dir that works on any platform.

An example would be: https://github.com/Ardour/ardour/blob/ma...4chaps.lua

ARDOUR.LuaAPI.build_filename(...) creates a filename from a series of elements using the correct separator for filenames ("\" on windows, "/" on other systems).
Reply
#4
Thanks to both of you for your replies. @x42 That is a very handy way to do it! Sound work nicely.

I have not done anything with it yet. Had a few surprises this weekend, such as a cat stuck in my HVAC duct work! GAWD!! 20 hours later, it is freed and fine.
ASUS M5A99FX PRO R2.0 w/AMD FX™-8350 Eight-Core Processor 32GB RAM
M-Audio Delta 1010 / Echo AudioFire 12
Mixbus v7.x on Fedora 33 64bit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)