MCPcopy Index your code
hub / github.com/PeerViewer/codebase / findResourceFile

Function findResourceFile

src/main.js:107–127  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

105// - /tmp/.mount_peervizdlxvC/resources/vnc-software/ (launched from appimage or .deb package installation)
106// - on windows: check console.log to know what __dirname and process.cwd() are
107function findResourceFile(filename) {
108 console.log("findResourceFile __dirname = ");
109 console.log(__dirname)
110 console.log("findResourceFile process.cwd = ");
111 console.log(process.cwd())
112 const magicName = "vnc-software" + nodePath.sep;
113 const parts = __dirname.split(nodePath.sep);
114 let appImageMount = parts.slice(0, -3).join(nodePath.sep); // /tmp/.mount_peervizdlxvC/resources/app.asar/.webpack/main becomes /tmp/.mount_peervizdlxvC/resources
115 // placesToCheck are directories that should end with a slash
116 let placesToCheck = [magicName, appImageMount + nodePath.sep + magicName, nodePath.sep];
117 for (const str of placesToCheck) {
118 let fullName = str + filename;
119 console.log("checking exists: " + str);
120 if (existsSync(str)) {
121 console.log("exists: " + str);
122 return fullName;
123 } else {
124 console.log("no exists: " + str);
125 }
126 }
127}
128
129ipcMain.on('run-server', (event) => {
130 // Make sure this OS is supported

Callers 2

main.jsFile · 0.85
findAndRunProcessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected