So I have my first Synchronet BAJA program almost complete. Along the
way I run into a few possible issues that I need answered.
Are there system variables the directory locations configured in SCFG?
My program opens data files and I would like the files to be stored in
the SBBS/DATA/<MYPROGRAM> folder. I am currently accomplishing this by using "/sbbs/data/<MYPROGRAM>" (linux path). Would the proper way be
to use "../data/<MYPROGRAM>"? But that leads me to another question... What if the DATA folder is set to be somewhere else in SCFG?
Is the DATA directory the best place to store files for External
Programs or is there another directory that would be better?
Linux vs. Windows... No not a debate... when working with paths and files... linux uses "/" while windows uses "\". Do I need to figure
out what OS is being used and use the proper slash or will something interally figure it out?
So I have my first Synchronet BAJA program almost complete. Along the way I run into a few possible issues that I need answered.
Are there system variables the directory locations configured in SCFG? My program opens data files and I would like the files to be stored in the SBBS/DATA/<MYPROGRAM> folder. I am currently accomplishing this by using "/sbbs/data/<MYPROGRAM>" (linux path). Would the proper way be to use "../data/<MYPROGRAM>"? But that leads me to another question... What if the DATA folder is set to be somewhere else in SCFG?
Is the DATA directory the best place to store files for External Programs
or is there another directory that would be better?
Linux vs. Windows... No not a debate... when working with paths and
files... linux uses "/" while windows uses "\". Do I need to figure out
what OS is being used and use the proper slash or will something interally figure it out?
"/sbbs/data/<MYPROGRAM>" (linux path). Would the proper way be to use "../data/<MYPROGRAM>"? But that leads me to another question... What if the DATA folder is set to be somewhere else in SCFG?
Is the DATA directory the best place to store files for External Programs
or is there another directory that would be better?
That shouldn't matter. Synchronet by default starts in the exec directory,
I believe. So you have the ability to use "../" to go back one directory, and continue from there. Using exact paths is not a problem, though.
Baja modules can use the "%j" command-line specifer to get the configured "data dir" location (see http://wiki.synchro.net/config:cmdline for examples). In this case, '%j' is the specifier for the data directory and you can put that in a string via Baja, like so:
sprintf my_filepath "%%j%s" my_filename
(note the double-percent escaping above)
or:
set data_dir "%j"
what i would suggest you do is keep all the files from your mod out of everyone else's files. i've been guilty of violating that rule with my personal mods, but i really think that is what everyone should do. it
stops a mess from occuring and it makes updating easy.
if you want me to take a look at your script, get me on irc on irc.bbses.info [dont visit for 1 minute and leave, please]. i used to be great with baja but now i'm a bit rusty. it comes back to me after playing around with it a bit.
Linux vs. Windows... No not a debate... when working with paths and files... linux uses "/" while windows uses "\". Do I need to figure out what OS is being used and use the proper slash or will something
interally figure it out?
Once I feel it is ready for others to view, I will for sure. I go over my code once and a while and find a better way to do something and re-write that portion of the code. The script is pretty basic, but it got me
starting into BAJA.
Sysop: | Tandy |
---|---|
Location: | New York, USA |
Users: | 15 |
Nodes: | 13 (0 / 13) |
Uptime: | 65:40:28 |
Calls: | 335 |
Messages: | 113,200 |