SRombauts / UEPlasticPlugin

Plastic SCM Plugin for Unreal Engine
http://srombauts.github.io/UEPlasticPlugin
146 stars 28 forks source link

Linux support #119

Closed dacanizares closed 1 year ago

dacanizares commented 1 year ago

In order to run the plugin on Linux follow these steps:

  1. (Skip this step - already fixed https://github.com/PlasticSCM/UEPlasticPlugin/commit/935cefe197dada89d22f18a0a16c3661e05a665d) Modify PlasticSourceControlShell.h, line 13 :

    // BEFORE
    constexpr TCHAR* pchDelim = TEXT("\n");
    
    // NOW
    constexpr const TCHAR* pchDelim = TEXT("\n");
  2. After that change, the plugin must compile and run on Linux, but the working directory is not being handled correctly by some component, so you can create a custom bash script to set the right path for your project:

    #!/bin/bash
    cd /home/user/source/ue/project-location
    cm "$@"

The script will go to the project location and then pass all arguments to the cm command. When the extension asks for the PlasticSCM Path, instead of cm, put your bash script location. And that's it. A little bit hacky but it works while we get a propper fix.

SRombauts commented 1 year ago

Hey @dacanizares, thanks for the heads up!

I submitted a fix for the constexpr const TCHAR* pchDelim = TEXT("\n");

As for the script, I think that I read something similar some time ago about the Git plugin, and/or the Plastic plugin on MacOS... (edit: found one https://github.com/SRombauts/UEPlasticPlugin/issues/53) but I never tried to dig into the issue myself yet.

Do you have some logs showing the error?

Isn't it something that we could fix in the source code, eg in PlasticSourceControlShell.cpp in _StartBackgroundPlasticShell() to set the proper InWorkingDirectory?

Thanks!

dacanizares commented 1 year ago

Hi @SRombauts!

Yesterday I saw that all variables have correct values. My suspicion it's that FPlatformProcess::CreateProc doesn't use correctly the WorkingDirectory on Linux (or maybe the cm executable itself, not sure). I will try to find out why that is happening, but at least it's working with the script fix.

The log just says that /home/user/unreal/Build/Linux/ (the location of the UnrealEditor executable) is not a PlasticCM workspace.

Thanks!

dacanizares commented 1 year ago

Yes, that's the issue. The variable OptionalWorkingDirectory is not being used by the Unreal code. image

SRombauts commented 1 year ago

Hum, is this in Unreal Engine 5? I though I saw the variable being used...

If it's really not used, I imagine that we can workaround this by changing directory in Unreal before creating the process and changing back right after

dacanizares commented 1 year ago

@SRombauts here is the PR with that fix: https://github.com/SRombauts/UEPlasticPlugin/pull/120

I've tested locally and it's working.

If you have comments or any user reports further issues, please let me know.

SRombauts commented 1 year ago

Thank you for your awesome contribution @dacanizares

Sébastien

dacanizares commented 1 year ago

Thanks @SRombauts!

SRombautsU commented 1 year ago

Released on January the 17th as part of a bugfix release https://github.com/PlasticSCM/UEPlasticPlugin/releases/tag/1.7.1 🎉 Many Thanks Sébastien