Subj : JS Commission?
To   : Android8675
From : echicken
Date : Tue Jul 14 2020 11:05 pm

 Re: JS Commission?
 By: Android8675 to echicken on Tue Jul 14 2020 11:51:05

>> const story = backslash(format('stories/%s', argv[0]));
>> const save_dir = backslash(format('%sif/%s%d', system.data_dir, story,
>> user.number));
>> //debug
>> console.print(story);
>> console.crlf(2);
>> console.print(save_dir);

An> and it spits out:

>> stories/zork1.z3/

>> /sbbs/data/if/stories/zork1.z3/1/

An> the save path is fine, and I verified it works, but how do I drop the trailing
An> slash for the story file? Was thinking:

>> const story = format('stories/%s', argv[0]);

backslash(str) adds a slash or backslash to 'str', depending whether you are on *nix or Windows. I don't think it actually checks to see if the path exists, if there's a file or dir there, etc.

You might try:

const story = format('stories/%s', argv[0]);
const save_dir = backslash(format('%sif/%s', system.data_dir, story));
const save_file = format('%s%d', save_dir, user.number);

and then adjust your script to use save_file instead of save_dir.

Or you could condense it to:

const save_file = backslash(format('%sif/stories/%s', system.data_dir, argv[0])) + user.number;

---
echicken
electronic chicken bbs - bbs.electronicchicken.com
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com