| View previous topic :: View next topic |
| Author |
Message |
henasraf Voice

Joined: 02 Nov 2009 Posts: 4 Location: Bat Yam, Israel
|
Posted: Mon Dec 14, 2009 3:24 am Post subject: Absolute path in Windrop? |
|
|
| Yes, I know it's tricky. But I tried and I can't find the trick! What do I do to be able to refer to a file using an absolute path in Tcl used by Windrop? Please help D: |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Mon Dec 14, 2009 9:53 am Post subject: |
|
|
I tend to use the 'file join' command to add whatever separator is appropriate for the operating environment. This would work irrespective of the bot being an Eggdrop on a Linux shell or a Windrop on your Windows based PC.
For example you could enquire if the directory c:\windows and/or d:\windows exists using the following Tcl via the windrops partyline (providing of course partyline .tcl commands are activated on in the bot's .conf file) :-
[13:41] <arfer> .tcl set x [file isdirectory [file join c: windows]]
[13:41] <osmosis> Tcl: 1
[13:55] <arfer> .tcl set x [file isdirectory [file join d: windows]]
[13:55] <osmosis> Tcl: 0
If I was opening a file for reading with a path relative to the bots root directory, I could use something like the following for example :-
set id [open [file join scripts data whatever.txt] r] _________________ I must have had nothing to do |
|
| Back to top |
|
 |
|