• Some easy BAJA questions?

    From High Spirit@VERT/DCBBS to All on Wed Jan 8 10:31:46 2014
    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?

    Thanks for your help. :)

    -- High Spirit

    ---
    þ Synchronet þ Digital Creation BBS -- bbs.digitalcreationbbs.com
  • From Access Denied@VERT/PHARCYDE to High Spirit on Wed Jan 8 12:48:48 2014
    Hello High,

    On 08 Jan 14 10:31, High Spirit wrote to All:

    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?

    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.

    Is the DATA directory the best place to store files for External
    Programs or is there another directory that would be better?

    No. External programs are usually stored in the /sbbs/xtrn directory.

    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?

    I believe it corrects it for you depending on the OS you run. Though, whatever OS you're running, you might want to at least try to use the proper way according to your OS.

    But if you're just asking in regards to any current default configurations, and hoping you don't have to go through the whole thing and change all the default settings, then no, you shouldn't have to.

    Regards,
    Nick

    --- GoldED+/LNX 1.1.5-b20130910
    * Origin: Dark Sorrow | darksorrow.us (723:1/701)
    þ Synchronet þ thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
  • From Digital Man@VERT to High Spirit on Wed Jan 8 16:52:21 2014
    Re: Some easy BAJA questions?
    By: High Spirit to All on Wed Jan 08 2014 10:31 am

    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?

    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"

    Is the DATA directory the best place to store files for External Programs
    or is there another directory that would be better?

    A sub-directory off of data might be a good place (like data/my_module).

    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?

    Just use a forward-slash, it'll work on both.

    digital man

    Synchronet "Real Fact" #52:
    Synchronet Blackjack was the first multi-node/multi-user game for Synchronet. Norco, CA WX: 61.9øF, 53.0% humidity, 1 mph ESE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Mro@VERT/BBSESINF to High Spirit on Wed Jan 8 22:20:07 2014
    Re: Some easy BAJA questions?
    By: High Spirit to All on Wed Jan 08 2014 10:31 am

    "/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?


    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.

    you can use the percent code variables and then go back ../to/your/dir
    in the past, i had to use double slashes, but i'm not sure if that issue has been corrected. regardling linux, i think you can just use forward slashes for both win and linux baja scripts. but it's been so long, i'm not sure. either way, you can get a text replacement program and switch the slashes and make 2 versions of your mod.

    in the past a lof people put their mods in sbbs/data/DIRNAME. for example, one guy had one called data/bajamods/modname for each addon he created.

    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. ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::
  • From Mro@VERT/BBSESINF to Access Denied on Wed Jan 8 22:22:42 2014
    Re: Some easy BAJA questions?
    By: Access Denied to High Spirit on Wed Jan 08 2014 12:48 pm

    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.



    i think it does, or maybe it's configurable in scfg.

    regardless he will be one
    sub dir into sbbs/ so ../ will get him out to the sbbs dir
    sbbs/xtrn is a great location for addons. some of my own have dirs off of sbbs, and i keep the games i wrote in sbbs/xtrn/
    ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::
  • From High Spirit@VERT/DCBBS to Digital Man on Thu Jan 9 10:45:35 2014
    Re: Some easy BAJA questions?
    By: Digital Man to High Spirit on Wed Jan 08 2014 04:52 pm

    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"

    Not sure how I missed that page... will bookmark it for future reference... thank you DM.

    -- High Spirit

    ---
    þ Synchronet þ Digital Creation BBS -- bbs.digitalcreationbbs.com
  • From High Spirit@VERT/DCBBS to Mro on Thu Jan 9 10:53:32 2014
    Re: Some easy BAJA questions?
    By: Mro to High Spirit on Wed Jan 08 2014 10:20 pm

    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.

    Yeah, that was the idea. Don't want to interfere with anything else that has been written.

    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.

    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.

    -- High Spirit

    ---
    þ Synchronet þ Digital Creation BBS -- bbs.digitalcreationbbs.com
  • From Nightfox@VERT/DIGDIST to High Spirit on Thu Jan 9 19:42:51 2014
    Re: Some easy BAJA questions?
    By: High Spirit to All on Wed Jan 08 2014 10:31:46

    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?

    I think Synchronet lets you use "/" and Synchronet takes care of the real path separator depending on what OS you use - so "/" should work on both Windows and Linux. That simplifies things a bit.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com
  • From Mro@VERT/BBSESINF to High Spirit on Thu Jan 9 22:21:20 2014
    Re: Some easy BAJA questions?
    By: High Spirit to Mro on Thu Jan 09 2014 10:53 am

    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.


    the good thing about baja is there's about 2-3 ways to do something.
    you wont really hit a wall until you get into some really advanced stuff.
    smeg was a great baja programmer and very creative. he's a good one to learn from. one of his greatest attributes was his creativity.
    ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::