Skip to content
Snippets Groups Projects
Commit b3209cd5 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

We need store the file full path in the section name

We need to support the same filename in different directories.

The 'path' key is just an artifact and not normally used when read,
so that was a distraction that apparently confused me previously
and I broke this functionality in commit c44ed79a.

This should fix the issues reported by xbit (XBITBBS) on DOVE-Net.

Also, don't open the file.ini for write-access (unnecessary).
parent a6f9d481
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ require("cga_defs.js", 'LIGHTGRAY');
require("sbbsdefs.js", 'P_CPM_EOF');
var file_cnf = new File(system.ctrl_dir + "file.ini");
if(!file_cnf.open(file_cnf.exists ? 'r+':'w+')) {
if(!file_cnf.open('r')) {
alert("Error opening " + file_cnf.name);
exit(0);
}
......@@ -114,7 +114,7 @@ while(bbs.online) {
break;
i--;
}
var path;
var fname;
var files = directory(backslash(txtsec_data(usrsec[cursec])) + "*");
for(var f = 0; f < files.length; f++) {
var match = false;
......@@ -123,24 +123,25 @@ while(bbs.online) {
match = true;
}
if(!match) {
path = file_getname(files[f]);
fname = file_getname(files[f]);
break;
}
}
console.print(format(bbs.text(AddTextFilePath)
,system.data_dir, usrsec[cursec].code.toLowerCase()));
var path = console.getstr(path, 128, K_EDIT|K_LINE|K_TRIM);
if(!path || console.aborted)
fname = console.getstr(fname, 128, K_EDIT|K_LINE|K_TRIM);
if(!fname || console.aborted)
break;
var path = fname;
if(!file_exists(path))
path = backslash(txtsec_data(usrsec[cursec])) + path;
path = backslash(txtsec_data(usrsec[cursec])) + fname;
console.printfile(path);
console.crlf();
console.print(bbs.text(AddTextFileDesc));
var desc = console.getstr(file_getname(path), 70, K_EDIT|K_LINE|K_TRIM|K_AUTODEL);
if(!desc || console.aborted)
break;
list.splice(i, 0, { name: file_getname(path), desc: desc, path: path });
list.splice(i, 0, { name: path, desc: desc });
write_list(usrsec[cursec], list);
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment