Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest Build Paths use Mixed Directory Separaters, Fails to Run on Linux #2126

Open
NikeLaosClericus opened this issue Mar 21, 2024 · 5 comments
Labels
Status: verified Issue is verified to occur on latest version Type: bug

Comments

@NikeLaosClericus
Copy link

NikeLaosClericus commented Mar 21, 2024

Are you on the latest version of Nitrox?

Yes, I'm on the latest commit of the repo (only for experts).

Which OS are you playing on?

Windows, Server on Linux

On which platform did you buy Subnautica?

Steam

Describe the issue.

Latest release build (1.7.1.0) of the server runs perfectly on Linux server.
Latest Commit compiles and runs perfectly on Windows, but fails on Linux with specific issue of resource not found.
Looking at the error message, the URI is using both Windows(\) and Unix(/) style directory separators at the same time.
Could not find file "/home/container/subnautica/Subnautica_Data/StreamingAssets/aa\StandaloneWindows64\precursor_bluekeyterminal.prefab_456b318dc62a7e270db6cd7881f6ebea.bundle"

Describe the steps you took to encounter the bug.

Searching the code to find the line that created this string, I found ample usage of Path.Combine, which is apparently an issue as it defaults to Windows directory separators when compiled on windows.
I tried adding a ".Replace('\\','/')" to every instance, but it had the same exact issue after that (is there a compiler cache I need to clear after making this code change?).
I tried to compile for Linux using "-r linux_x64" but that just keeps failing, asking to run the build tool (which I have also built with the runtime flag).
Is there an easy way to fix the pathing issue for Linux server compilation?

Relevant log output

[11:22:58.310] [INF] Starting NitroxServer Alpha v1.8.0.0 for Subnautica
[11:22:58.660] [INF] Using game files from: /home/container/subnautica
[11:23:01.852] [ERR] Could not find file "/home/container/subnautica/Subnautica_Data/StreamingAssets/aa\StandaloneWindows64\precursor_bluekeyterminal.prefab_456b318dc62a7e270db6cd7881f6ebea.bundle"
System.IO.FileNotFoundException: Could not find file "/home/container/subnautica/Subnautica_Data/StreamingAssets/aa\StandaloneWindows64\precursor_bluekeyterminal.prefab_456b318dc62a7e270db6cd7881f6ebea.bundle"
File name: '/home/container/subnautica/Subnautica_Data/StreamingAssets/aa\StandaloneWindows64\precursor_bluekeyterminal.prefab_456b318dc62a7e270db6cd7881f6ebea.bundle'
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in :0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in :0
at AssetsTools.NET.Extra.AssetsManager.LoadBundleFile (System.String path, System.Boolean unpackIfPacked) [0x00000] in <3d198968416b431196c5f89d3e9caec7>:0
at NitroxServer_Subnautica.Resources.Parsers.PrefabPlaceholderGroupsParser.GetAllPrefabPlaceholdersGroupsFast () [0x00051] in :0
at NitroxServer_Subnautica.Resources.Parsers.PrefabPlaceholderGroupsParser.ParseFile () [0x00013] in :0
at NitroxServer_Subnautica.Resources.ResourceAssetsParser.Parse () [0x00038] in :0
at NitroxServer_Subnautica.SubnauticaServerAutoFacRegistrar.RegisterDependencies (Autofac.ContainerBuilder containerBuilder) [0x0008f] in :0
at NitroxModel.Core.NitroxServiceLocator.InitializeDependencyContainer (NitroxModel.Core.IAutoFacRegistrar[] registrars) [0x0000c] in :0
at NitroxServer_Subnautica.Program.StartServer (System.String[] args) [0x00173] in :0
at NitroxServer_Subnautica.Program.Main (System.String[] args) [0x000ad] in :0
at NitroxServer_Subnautica.Program.

(System.String[] args) [0x0000c] in :0
[11:23:06.988] [INF] Starting NitroxServer Alpha v1.8.0.0 for Subnautica
[11:23:07.315] [INF] Using game files from: /home/container/subnautica

@NikeLaosClericus NikeLaosClericus added Status: to verify Issue is currently not verified by trusted user Type: bug labels Mar 21, 2024
@dartasen dartasen added Status: verified Issue is verified to occur on latest version and removed Status: to verify Issue is currently not verified by trusted user labels Apr 14, 2024
@CillyCil
Copy link

Same issue here

@Jannify
Copy link
Member

Jannify commented May 31, 2024

Path.Combine() shouldn't mess up like that, maybe it has something to do with emulation software like wine? If it's really the problem of Path.Combine(), Path.GetFullPath() seems to correct the whole path depending on which system you have.

@NikeLaosClericus
Copy link
Author

NikeLaosClericus commented May 31, 2024

According to:
https://www.davidboike.dev/2020/06/path-combine-isnt-as-cross-platform-as-you-think-it-is/
and:
https://stackoverflow.com/questions/26067224/using-path-combine-to-form-a-linux-path-on-a-windows-system
(This is where I found the winPath.Replace('\\','/'); suggestion)

Path.Combine functions differently on windows vs linux.

My problem, I think, is that I'm trying to compile for Linux on my Windows desktop.
So, path combine is adding win style directory seperators (\), but Linux can't understand that.

Given that 1.7.1.0 was compiled and runs perfectly on both platforms, how was that compiled?
Was it compiled on a Linux system for both?
I've seen comments that Nix style separators (/) should work on both platforms, so that might be the solution.

@Jannify
Copy link
Member

Jannify commented May 31, 2024

I took a look how the mixed path could come together and found out that Subnautica\Subnautica_Data\StreamingAssets\aa\catalog.json uses win file paths (at least I don't think that there is a different version of it on linux machines). Therefore we need to sanitize the path at PrefabPlaceholderGroupsParser.cs:L109 with Path.GetFullPath(), before we use it in AT3.

@killzoms
Copy link
Collaborator

killzoms commented Jun 6, 2024

Yea that file is the source of the problem, I had looked into that and fixed it locally in the past but I guess I never pushed any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: verified Issue is verified to occur on latest version Type: bug
Projects
None yet
Development

No branches or pull requests

5 participants