add file open
This commit is contained in:
@@ -120,27 +120,15 @@ function DBTextures.download(name, url, callback)
|
||||
if File.Exists(localPath) then
|
||||
_url = Path.Combine("file://", localPath)
|
||||
end
|
||||
local assetType
|
||||
if MyUtl.isImage(name) then
|
||||
assetType = CLAssetType.texture
|
||||
else
|
||||
assetType = CLAssetType.bytes
|
||||
end
|
||||
|
||||
local www =
|
||||
WWWEx.get(
|
||||
_url,
|
||||
nil,
|
||||
CLAssetType.texture,
|
||||
CLAssetType.bytes,
|
||||
function(content, orgs)
|
||||
isDownoading[name] = nil
|
||||
if content then
|
||||
local bytes
|
||||
if assetType == CLAssetType.texture then
|
||||
bytes = content:GetRawTextureData()
|
||||
else
|
||||
bytes = content
|
||||
end
|
||||
local bytes = content
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(localPath))
|
||||
File.WriteAllBytes(localPath, bytes)
|
||||
Utl.doCallback(downloadCallback[name], content, localPath)
|
||||
@@ -162,6 +150,7 @@ function DBTextures.download(name, url, callback)
|
||||
2
|
||||
)
|
||||
isDownoading[name] = www
|
||||
return www
|
||||
end
|
||||
|
||||
return DBTextures
|
||||
|
||||
Reference in New Issue
Block a user