MCPcopy Index your code
hub / github.com/code3-dev/dengvpn / getResourcePath

Function getResourcePath

main.js:16–43  ·  view source on GitHub ↗
(relativePath)

Source from the content-addressed store, hash-verified

14
15// Function to get proper resource path (works in both development and production)
16function getResourcePath(relativePath) {
17 // Handle core paths specially
18 if (relativePath.startsWith('core')) {
19 // Use the global core directory path
20 const corePath = global.__coredir || path.join(__dirname, 'core');
21
22 // If the path is just 'core', return the directory
23 if (relativePath === 'core') {
24 return corePath;
25 }
26
27 // If the path is more specific (e.g., 'core/xray.exe'), append to core path
28 // Handle both 'core/' and 'core\' separators
29 let cleanPath = relativePath.replace('core/', '').replace('core\\', '');
30
31 // Special handling for xray files - they're in the xray subdirectory
32 if (cleanPath === 'xray.exe') {
33 return path.join(corePath, 'xray', cleanPath);
34 }
35
36 return path.join(corePath, cleanPath);
37 } else {
38 // For other resources, use the normal path
39 return app.isPackaged
40 ? path.join(process.resourcesPath, relativePath)
41 : path.join(__dirname, relativePath);
42 }
43}
44
45// Use the global asset path for any file references
46function getAssetPath(relativePath) {

Callers 7

main.jsFile · 0.85
fetchConfigsFunction · 0.85
setSystemProxyFunction · 0.85
disableSystemProxyFunction · 0.85
checkCoreDirectoryFunction · 0.85
ensureCoreFilesFunction · 0.85
downloadCoreFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected