(path, index = 0, prefixes = false)
| 2859 | } |
| 2860 | |
| 2861 | function realPath(path, index = 0, prefixes = false) |
| 2862 | { |
| 2863 | const _isServer = isServer(path); |
| 2864 | const segments = splitPath(_isServer ? serverClient.fixPath(path) : path); |
| 2865 | const len = segments.length; |
| 2866 | const numSegments = len + index; |
| 2867 | |
| 2868 | let virtualPath; |
| 2869 | |
| 2870 | let newPath = virtualPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; |
| 2871 | |
| 2872 | if(_isServer) |
| 2873 | { |
| 2874 | let adress = p.normalize(serverClient.getAdress(path)); |
| 2875 | |
| 2876 | newPath = p.join(tempFolder, sha1(adress)); |
| 2877 | virtualPath = adress; |
| 2878 | |
| 2879 | if(!segments[1]) |
| 2880 | segments[0] = segments[1] = segments[2] = ''; |
| 2881 | else |
| 2882 | segments[0] = segments[1] = ''; |
| 2883 | } |
| 2884 | |
| 2885 | for(let i = 1; i < len; i++) |
| 2886 | { |
| 2887 | newPath = p.join(newPath, segments[i]); |
| 2888 | virtualPath = p.join(virtualPath, segments[i]); |
| 2889 | |
| 2890 | if(i < numSegments) |
| 2891 | { |
| 2892 | const extension = app.extnameC(newPath); |
| 2893 | |
| 2894 | if(extension) |
| 2895 | { |
| 2896 | if(compatible.compressed.has(extension) /* && fs.existsSync(newPath) && !fs.statSync(newPath).isDirectory()*/) |
| 2897 | { |
| 2898 | let sha = sha1(p.normalize(virtualPath)); |
| 2899 | |
| 2900 | if(prefixes) |
| 2901 | { |
| 2902 | for(let ext in prefixes) |
| 2903 | { |
| 2904 | if(compatible.compressed[ext].has(extension)) |
| 2905 | { |
| 2906 | sha = prefixes[ext]+'-'+sha; |
| 2907 | |
| 2908 | break; |
| 2909 | } |
| 2910 | } |
| 2911 | } |
| 2912 | |
| 2913 | newPath = p.join(tempFolder, sha); |
| 2914 | } |
| 2915 | else if(compatible.image.convert.has(extension) && i + 1 === len) |
| 2916 | { |
| 2917 | const sha = sha1(p.dirname(p.normalize(virtualPath))); |
| 2918 |
no test coverage detected