mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
make full paths when needed
This commit is contained in:
parent
4d671e3ba3
commit
a822465cf4
1 changed files with 18 additions and 3 deletions
|
|
@ -119,7 +119,8 @@ var clite = {
|
|||
clite/core.js:/usr/clite/core.js:0:0:-rw-r-----
|
||||
clite/core.css:/usr/clite/web/core.css:0:0:-rw-r-----
|
||||
data/intro.txt:/usr/share/introduction:0:0:-rw-rw-r--
|
||||
data/about.txt:/usr/share/site/about:0:0:-rw-rw-r--`;
|
||||
data/about.txt:/usr/share/site/about:0:0:-rw-rw-r--
|
||||
data/about.txt:/usr/bin/stuff/foo:0:0:-rw-rw-rw-`;
|
||||
init2(d);
|
||||
return;
|
||||
}
|
||||
|
|
@ -154,11 +155,12 @@ data/about.txt:/usr/share/site/about:0:0:-rw-rw-r--`;
|
|||
var perms = parts[4];
|
||||
|
||||
var fn = vfsapi.getNode(path);
|
||||
// TODO: make the full path if needed
|
||||
if (!fn) {
|
||||
if (perms[0] == 'd') {
|
||||
vfsapi.mkDir(path);
|
||||
vfsapi.mkPath(path);
|
||||
}else{
|
||||
var dir = clite.lib.dirname(path);
|
||||
vfsapi.mkPath(dir);
|
||||
vfsapi.mkFile(path);
|
||||
}
|
||||
fn = vfsapi.getNode(path);
|
||||
|
|
@ -681,6 +683,19 @@ clite.vfs = {
|
|||
parent.data.content.push(n);
|
||||
return true;
|
||||
}
|
||||
vfsdata.api.mkPath = function(path) {
|
||||
var parts = path.split('/');
|
||||
var p = '';
|
||||
parts.forEach(function(part) {
|
||||
if (part == '')
|
||||
return;
|
||||
p += '/'+part;
|
||||
vfsdata.api.mkDir(p);
|
||||
});
|
||||
if (vfsdata.api.getNode(path))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
vfsdata.api.remove = function(path) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue