1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

Update vfs.lua

This commit is contained in:
Dany LE 2022-08-21 16:26:57 +02:00 committed by GitHub
parent fd31477739
commit e775e9d7e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,16 +3,16 @@ local vfs = {}
vfs.ospath = function(path) vfs.ospath = function(path)
local user = SESSION.user local user = SESSION.user
local prefix = string.match(path, "%a+://") local prefix = string.match(path, "%a+:/")
if(prefix ~= nil) then if(prefix ~= nil) then
local suffix = string.gsub(path,prefix,"") local suffix = string.gsub(path,prefix,"")
if prefix == "home://" then if prefix == "home:/" then
return string.format(VFS_HOME,user)..'/'..suffix return string.format(VFS_HOME,user)..'/'..suffix
elseif prefix == "desktop://" then elseif prefix == "desktop:/" then
return string.format(VFS_HOME,user).."/.desktop/"..suffix return string.format(VFS_HOME,user).."/.desktop/"..suffix
elseif prefix == "shared://" then elseif prefix == "shared:/" then
return require("shared").ospath(std.trim(suffix,"/")) return require("shared").ospath(std.trim(suffix,"/"))
elseif prefix == "os://" then elseif prefix == "os:/" then
return WWW_ROOT.."/"..suffix return WWW_ROOT.."/"..suffix
else else
return nil return nil