From ef44be8240a8fc4851265ec286a7c53b09cad38b Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 2 Aug 2012 07:43:57 +0100 Subject: [PATCH] fileLoc defined by saveType, error catching no / If we're saving a new file, fileLoc is the file location otherwise it's empty Error catching given filenames not beginning with a / by prefixing with one --- lib/file-control.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index 5ebdd83..f85667b 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -253,13 +253,13 @@ if (action=="load") { if (action=="save") { 0||$saveType=="saveAs") { - $saveLoc = $saveType=="saveAs" ? $fileLoc : ""; - echo "fileLoc = '".$saveLoc."';" + if (strpos($fileName,"[NEW]")>0) {echo "fileLoc = '".$fileLoc."';";} else {echo "fileLoc = '';";}; ?> newFileName = top.ICEcoder.getInput(fileLoc != "" ? 'Enter filename to save at '+fileLoc : 'Enter filename (including path, prefixed with /)' ,''); + if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName} if (newFileName) { newFileName = fileLoc == "" ? newFileName : fileLoc + "/" + fileName; }