mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			659 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			659 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { readFileSync } from "fs";
 | |
| import { platform } from "os";
 | |
| 
 | |
| export function isNixOS() {
 | |
|     if (platform() !== "linux") return false;
 | |
|     const osReleaseFile = readFileSync("/etc/os-release", "utf-8");
 | |
|     return osReleaseFile.includes("ID=nixos");
 | |
| }
 | |
| 
 | |
| export function resetPath() {
 | |
|     // On Unix-like systems, PATH is usually inherited from login shell
 | |
|     // but npm prepends node_modules/.bin. Let's remove it:
 | |
|     const origPath = process.env.PATH || "";
 | |
| 
 | |
|     // npm usually adds something like ".../node_modules/.bin"
 | |
|     process.env.PATH = origPath
 | |
|         .split(":")
 | |
|         .filter(p => !p.includes("node_modules/.bin"))
 | |
|         .join(":");
 | |
| }
 |