Windows paths

How does lua handle Windows paths given that \ is a special character?

If this command is run on Windows:

path = renoise.app():prompt_for_filename_to_read({"*.*"}, "Select File")  

And a file is slected, what does the the string in ‘path’ look like? I’m on a Mac so can’t test this.

Thanks

  
  
 local PATH_SEPARATOR = "/"  
  
 if (os.platform() == "WINDOWS") then  
 PATH_SEPARATOR = "\\"  
 end   
 local target_path = target_root...PATH_SEPARATOR..ins_folder..PATH_SEPARATOR..filename  
  

Thanks :)

“/” is accepted everywhere on Windows too though.

I didn’t know that, thanks :)

That would be useful if outputting paths. However say if you are reading a paths from Window into a variable and then print that path it will display "" however internally it is storing them as “\” and this is what was confusing me. Anyway problem solved now, thanks for the help.

You said it yourself in first post, \ is a special character. If you ever learned this, you’ve probably also seen a table like this:

  
\n newline  
\t tab  
\' '  
\" "  
\\ \  
  

It’s been like that for many years :) so yeah, Windows paths are a b*tch.

link to python docs page with a table
tmi on wikipedia
article on the dangers of the backslash :D