}
return os.Rename(source, target)
}
+
+func MakeDir(target string) os.Error {
+ target = canonicalizePath(target)
+ if !checkInJail(target) {
+ return os.NewError("Path outside of jail")
+ }
+
+ dir, _ := path.Split(target)
+ isValid, _ := IsValid(dir)
+ if !isValid {
+ return os.NewError("Containing directory not valid")
+ }
+
+ return os.Mkdir(target, 0644)
+}
//
// Armadillo File Manager
-// Copyright (c) 2010, Robert Sesek <http://www.bluestatic.org>
-//
+// Copyright (c) 2010-2011, Robert Sesek <http://www.bluestatic.org>
+//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or any later version.
}
okResponse(response, data)
}
+ case "mkdir":
+ path := request.FormValue("path")
+ err := paths.MakeDir(path)
+ if err != nil {
+ errorResponse(response, err.String())
+ } else {
+ data := map[string]interface{}{
+ "path": path,
+ "error": 0,
+ }
+ okResponse(response, data)
+ }
case "tv_rename":
newPath, err := tv_rename.RenameEpisode(request.FormValue("path"))
if err != nil {