MCPcopy
hub / github.com/ollm/OpenComic / firstCompressedFile

Function firstCompressedFile

scripts/file-manager.js:3028–3050  ·  view source on GitHub ↗
(path, index = 0, checkDirectory = true)

Source from the content-addressed store, hash-verified

3026}
3027
3028function firstCompressedFile(path, index = 0, checkDirectory = true)
3029{
3030 let segments = splitPath(path);
3031 let len = segments.length;
3032
3033 let newPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : '';
3034 let numSegments = len + index;
3035
3036 let _isServer = isServer(path);
3037
3038 for(let i = 1; i < len; i++)
3039 {
3040 newPath = join(newPath, segments[i]);
3041
3042 if(i < numSegments)
3043 {
3044 if(compatible.compressed(newPath) && (!checkDirectory || _isServer || !fs.existsSync(newPath) || !fs.statSync(newPath).isDirectory()))
3045 return newPath;
3046 }
3047 }
3048
3049 return newPath;
3050}
3051
3052function firstCompressedFileRealPath(path, index = 0)
3053{

Callers 3

fileFunction · 0.85
simpleExistsFunction · 0.85

Calls 4

splitPathFunction · 0.85
isEmptyFunction · 0.85
isServerFunction · 0.85
joinFunction · 0.85

Tested by

no test coverage detected