0

I have a elisp script that needs to work across different OS platform. So I need to use the convert-standard-filename to make sure the filename confirms to OS standard.

But I found Emacs for Windows can handle Windows filename correctly, and it somehow cannot handle the filename returned by the convert-standard-filename.

So I need a way to test if the script is executing in s minGW environment, and return the raw filename.

6
  • Within MSYS2, the environment variable MSYSTEM is usually set. You could check against it with something like (if (getenv "MSYSTEM") ...) Commented Apr 11, 2017 at 7:01
  • My bad. I am using Emacs for Windows. I thought it relies on MSYS, but it not. I think it only depends on the mingw system.
    – David S.
    Commented Apr 11, 2017 at 9:04
  • 1
    What is the value of the variable system-type?
    – Tobias
    Commented Apr 11, 2017 at 11:33
  • Within MSYS2, you could change the test to something like this (if (string-match "MINGW" (getenv "MSYSTEM")) ...). I can't say if works for MinGW. Commented Apr 11, 2017 at 16:07
  • @ArashEsbati, no minGW does not set the MSYSTEM variable.
    – David S.
    Commented Apr 12, 2017 at 2:17

1 Answer 1

0

Using system-type

If you can roll out cygwin environment, then using system-type is a reliable way to test if Emacs is running in minGW or MSYS environment. If system-type is windows-nt, it must be one of the two.

Alternatively

So far, I found using the SHELL variable in the Emacs environment is a reliable to to identify it it is running in minGW environment.

No matter in MSYS or mingGW environment, the SHELL variable is set to

/some/path/cmdproxy.exe

And I use the last part as a identifier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.