|
1 |
| -import { dirname as pathDirname } from 'path'; |
| 1 | +import { existsSync, readFileSync } from 'node:fs'; |
| 2 | +import { dirname as pathDirname, join as pathJoin } from 'path'; |
2 | 3 |
|
3 | 4 | import ProcessUtils from '.';
|
4 | 5 |
|
@@ -55,11 +56,35 @@ export class Process {
|
55 | 56 | return pathDirname(ProcessUtils.getProcessPath(this.handle));
|
56 | 57 | }
|
57 | 58 |
|
58 |
| - // If using osu-winello |
| 59 | + // If using wine (not symlinked into image) |
59 | 60 | if (
|
60 | 61 | process.platform === 'linux' &&
|
61 | 62 | this.getProcessPath().match('wine-preloader')
|
62 | 63 | ) {
|
| 64 | + // bicycle for osu-winnello |
| 65 | + // I swear a god, I will create a delete osu-winnello repo PR |
| 66 | + // if you guys will break this |
| 67 | + const homeEnv = process.env.HOME || ''; |
| 68 | + const xdgDataHome = process.env.XDG_DATA_HOME || ''; |
| 69 | + const shareFolder = |
| 70 | + xdgDataHome !== '' |
| 71 | + ? xdgDataHome |
| 72 | + : pathJoin(homeEnv, '.local/share'); |
| 73 | + const osuWinelloPath = pathJoin(shareFolder, 'osuconfig/osupath'); |
| 74 | + |
| 75 | + if (existsSync(osuWinelloPath)) { |
| 76 | + // osu-sinello script installation found |
| 77 | + return readFileSync(osuWinelloPath, 'utf-8').trim(); |
| 78 | + } |
| 79 | + |
| 80 | + const overridenOsuPath = process.env.TOSU_OSU_PATH || ''; |
| 81 | + if (overridenOsuPath !== '') { |
| 82 | + // for other genius, who have their custom wine prefixes |
| 83 | + // with symlinking or other breaking default cwd???? |
| 84 | + // tldr should be like: /home/kotrik/.local/share/osu-wine/osu! |
| 85 | + return overridenOsuPath; |
| 86 | + } |
| 87 | + |
63 | 88 | return this.getProcessCommandLine()
|
64 | 89 | .slice(2)
|
65 | 90 | .replace(/\\/g, '/')
|
|
0 commit comments