mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Fix to save path containing filenames
Detect a . in the filePath and if we find one, save at root instead (Stops us saving at a path that's actually a file, eg |TEST|file.txt)
This commit is contained in:
@@ -676,12 +676,15 @@ var ICEcoder = {
|
||||
|
||||
// Save a file
|
||||
saveFile: function(saveAs) {
|
||||
var saveType, filePath;
|
||||
var saveType, filePath, pathPrefix;
|
||||
|
||||
saveType = saveAs ? "saveAs" : "save";
|
||||
filePath = ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");
|
||||
if (filePath=="|[NEW]" && top.ICEcoder.selectedFiles.length>0) {
|
||||
filePath = top.ICEcoder.selectedFiles[0]+filePath;
|
||||
pathPrefix = top.ICEcoder.selectedFiles[0];
|
||||
filePath = pathPrefix.lastIndexOf(".") == -1 || pathPrefix.lastIndexOf(".") < pathPrefix.lastIndexOf("|")
|
||||
? pathPrefix+filePath
|
||||
: "|[NEW]";
|
||||
}
|
||||
filePath = filePath.replace("||","|");
|
||||
top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+filePath+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+saveType);
|
||||
|
||||
Reference in New Issue
Block a user