but sys_bashfilename doesn’t convert the (adequately) created windows separator.
D'oh. I'm sorry, it's the other way round :-D The function you need is sys_unbashfilename()

On 23.06.2022 16:54, Pierre Alexandre Tremblay wrote:
Ok the problem is simple: tcl accepts only path separated with ‘/‘ in windows 
but sys_bashfilename doesn’t convert the (adequately) created windows 
separator. So I’ll do a character substitutor.

Objvously the code is free and online so people can have a look or I can post 
here if that helps

On 23 Jun 2022, at 14:48, Christof Ressi <i...@christofressi.com> wrote:

Generally, Pd only uses forward slashes as file path seperators. You can use 
sys_bashfilename() on the path generated by tempnam().

On 23.06.2022 15:36, Pierre Alexandre Tremblay wrote:
Hello

In an external I use the superb tmpnam(x) to generate a temp file path to use 
and delete. All is good then… for MacOS and Linux that is! In Windows, the code 
in C does create a file but when I try to pass it to TCL to open there, like in 
the amazing ELSE’s pic, I can’t - the inverted backslash are deleted. I tried 
also, like in else, using open_canvas to no avail.

Now I tried to use on windows the ELSE’s pic to troubleshoot and it seems I 
have 2 problems:

#1:

- PIC will accept the file I create when it is on the Documents folder, but not 
the exact same file in the temp folder created by tmpnam. So this will work:
open C:/Users/pa/Documents/tmp.0.8eDtGO

But not this:
open C:/Users/pa/appData/Local/tmp.0.8eDtGO

===

#2

- PIC will only accept with straight slashes /

C:\Users\pa\Documents\tmp.0.8eDtGO

Won’t work but

C:/Users/pa/Documents/tmp.0.8eDtGO’

will

===

So I wonder if there are pearls of wisdom on temp file generation for cross OS 
compile. At the moment, if I use the PIC hack of going through canvas_open I 
get a ‘void’ name, and if I don’t I get errors due to the backslash not being 
digested by TCL (it seems - the error is as above)

p

Ps Alexandre, without you and your code, this object would not exist, so 
39402940923 thanks!


_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list



_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to