basic: save will put .bas extension if one is not given

This commit is contained in:
minjaesong
2020-12-16 13:32:13 +09:00
parent b67c8ede6f
commit e61fe9e0af
2 changed files with 2 additions and 3 deletions

View File

@@ -2818,6 +2818,8 @@ bF.run = function(args) { // RUN function
};
bF.save = function(args) { // SAVE function
if (args[1] === undefined) throw lang.missingOperand;
if (!args[1].toUpperCase().endsWith(".BAS"))
args[1] += ".bas";
fs.open(args[1], "W");
var sb = "";
cmdbuf.forEach((v, i) => sb += i+" "+v+"\n");

View File

@@ -1,3 +0,0 @@
10 DEFUN FAC(N)=IF N==0 THEN 1 ELSE N*FAC(N-1)
20 K=MAP(FAC, 1 TO 10)
30 PRINT K