Some players reported that the Steam app only shows a black screen. When I check their logs and their setups, I see that they use a symbolic link to link their game folder. For example, let's say that their game folder is at D:\Games\Steams\Bitburner\, they create a symbolic link at E:\GameData\Bitburner\ that points to their game folder, then launch the exe file at E:\GameData\Bitburner\bitburner.exe. The code in protocol.interceptFileProtocol won't be able to handle this case. url and filePath point to the symbolic link (E:\GameData\Bitburner\), but __dirname points to the real path (D:\Games\Steams\Bitburner\), so relativePath is wrong. This PR fixes this problem.
Other changes:
((method === "GET" && relativePath.startsWith("dist")) || relativePath.match(/^[a-zA-Z-_]*\.html/)) is changed to (method === "GET" && (relativePath.startsWith("dist") || relativePath.match(/^[a-zA-Z-_]*\.html/))).
I convert fileError.txt to fileError.html. When we return the plain text in fileError.txt, it's wrapped like this:
<html>
<head>
<meta name="color-scheme" content="light dark" />
</head>
<body>
<pre style="word-wrap: break-word; white-space: pre-wrap">
Attempts to access local files outside the normal game environment will be directed to this file.
</pre
>
</body>
</html>
The player cannot see the text because its color is the same as the background color.
Some players reported that the Steam app only shows a black screen. When I check their logs and their setups, I see that they use a symbolic link to link their game folder. For example, let's say that their game folder is at
D:\Games\Steams\Bitburner\
, they create a symbolic link atE:\GameData\Bitburner\
that points to their game folder, then launch the exe file atE:\GameData\Bitburner\bitburner.exe
. The code inprotocol.interceptFileProtocol
won't be able to handle this case.url
andfilePath
point to the symbolic link (E:\GameData\Bitburner\
), but__dirname
points to the real path (D:\Games\Steams\Bitburner\
), sorelativePath
is wrong. This PR fixes this problem.Other changes:
((method === "GET" && relativePath.startsWith("dist")) || relativePath.match(/^[a-zA-Z-_]*\.html/))
is changed to(method === "GET" && (relativePath.startsWith("dist") || relativePath.match(/^[a-zA-Z-_]*\.html/)))
.I convert
fileError.txt
tofileError.html
. When we return the plain text infileError.txt
, it's wrapped like this:The player cannot see the text because its color is the same as the background color.
Tested on Windows.