Launching rapidsetup from another folder

We are currently launching rsiconfig from our application, and initially we switched the working folder to the RSI\8.1.x folder so that all the files would be found. We want to keep our specific settings files in the same folder as our exe so we tried the following steps.

  1. We moved the settings.xml to the exe folder and renamed it to EtherCATsettings.xml. When launching rsiconfig we specify the full path to EtherCATsettings.xml and the RSI starts up fine. However, we realized that the axis files referenced in EtherCATsettings.xml were being picked up from the RSI\8.1.x folder and not the exe folder. We reasoned that this must be because the working directory is set to the RSI\8.1.x folder.
  2. We changed the launch so that the working directory is the same as the exe folder, and we moved the rsi.lic file to the exe folder as well. If the network is already started this works, but if the network isn’t started we get the following error:
    D:\Projects\cli\x64\Debug>c:\rsi\8.1.6\rsiconfig.exe EtherCATsettings.xml
    ERROR: Win32 RMP: device map error :: {platformOS.c, line 135} : RT Module failed to initialize RMP : Please check to see that RMP is started and running. GetLastError = 1 (Error 5125) (RSI::RapidCode::Impl::MotionController::InitControl) (Object 0) (File …\source\motioncontroller.cpp) (Line 399) (Version 8.1.6 for 04.04.02.RMP)
    RSI_INVALID_ID – this hardware is incompatible with RSI software (Error 1000000003) (RSI::RapidCode::Impl::MotionController::Init) (Object 0) (File …\source\motioncontroller.cpp) (Line 471) (Version 8.1.6 for 04.04.02.RMP)

We can also reproduce the problem running rsiconfig from the Windows CMD window.

Is it too hard to set the CWD of rsiconfig.exe (to the RSI directory) when you launch it?
(As a pessimistic IT guy) I would expect to have to replicate too many files/dirs in order to run it outside of the standard RSI directory.

Are you using system() to launch the executable, or something more customizable, like CreateProcess()? Or is it being called from a script? You could always _chdir() to the RSI directory before launching rsiconfig.exe. CreateProcess() allows a lpCurrentDirectory parameter.

You can always chdir() back to where you were once you invoke the subprocess.

We already having it working with CreateProcess setting the CWD but we would prefer to have the configuration files outside the RSI folder for ease of deployment and to simplify deployment of new versions of the RSI software.

Could you put the RSI directory inside your own app’s filesystem tree? That’s what we do.
Are you “installing” RSI (via MSI), or just using the compressed archive? I haven’t found any advantage to using the MSI, unless maybe you wanted to do software upgrades via SCCM or some other sort of software management system. This probably still isn’t quite what you want, I realize.

Interesting idea. I didn’t realize that the RSI folder would be happy in another location. It would mean including RSI in the SCCM so that it gets picked up by our installer, but maybe that’s not such a bad thing.

I shudder to suggest it, but you could perhaps use NTFS symlinks, too.

That would be scary! It probably works until somebody decides to format the drive as exFAT…