MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / checkVFSFolder

Function checkVFSFolder

src/toolchain.go:53–82  ·  view source on GitHub ↗

checkVFSFolder : Checks whether the Folder exists in provided virtual filesystem, if not, the Folder is created

(path string, vfs avfs.VFS)

Source from the content-addressed store, hash-verified

51
52// checkVFSFolder : Checks whether the Folder exists in provided virtual filesystem, if not, the Folder is created
53func checkVFSFolder(path string, vfs avfs.VFS) (err error) {
54
55 var debug string
56 _, err = vfs.Stat(filepath.Dir(path))
57
58 if fsIsNotExistErr(err) {
59 // Folder does not exist, will now be created
60
61 // If we are on Windows and the cache location path is NOT on C:\ we need to create the volume it is located on
62 // Failure to do so here will result in a panic error and the stream not playing
63 vm := vfs.(avfs.VolumeManager)
64 if vfs.OSType() == avfs.OsWindows && avfs.VolumeName(vfs, path) != "C:" {
65 vm.VolumeAdd(path)
66 }
67
68 err = vfs.MkdirAll(getPlatformPath(path), 0755)
69 if err == nil {
70
71 debug = fmt.Sprintf("Create virtual filesystem Folder:%s", path)
72 showDebug(debug, 1)
73
74 } else {
75 return err
76 }
77
78 return nil
79 }
80
81 return nil
82}
83
84// fsIsNotExistErr : Returns true whether the <err> is known to report that a file or directory does not exist,
85// including virtual file system errors

Callers 2

bufferingStreamFunction · 0.85
thirdPartyBufferFunction · 0.85

Calls 3

fsIsNotExistErrFunction · 0.85
showDebugFunction · 0.85
getPlatformPathFunction · 0.70

Tested by

no test coverage detected