2024-04-28 10:10:03 +08:00

15 lines
423 B
TypeScript

// @ts-nocheck
export const getLocalFilePath = (path: string) => {
if(typeof plus == 'undefined') return path
if(/^(_www|_doc|_documents|_downloads|file:\/\/|\/storage\/emulated\/0\/)/.test(path)) return path
if (/^\//.test(path)) {
const localFilePath = plus.io.convertAbsoluteFileSystem(path)
if (localFilePath !== path) {
return localFilePath
} else {
path = path.slice(1)
}
}
return '_www/' + path
}