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

On Windows, Red added to the path, can't be run from another folder on cmd #543

Closed
SoleSoul opened this issue Sep 30, 2013 · 5 comments
Closed
Labels
status.resolved Issue has been resolved without a change in the source code (should be elaborated in comments).

Comments

@SoleSoul
Copy link

Summary

Red can't be run from a different path on Windows.

How to reproduce

  • Put red.exe in a folder that is in the path
  • On the command line, navigate to another folder (not the one where red.exe is)
  • type 'red'

Expected behavior

The Red interpreter should run.

Observed behavior

c:>red
PROGRAM ERROR: Invalid encapsulated data.

@dockimbel
Copy link
Member

Some other crashing case (and workaround):

C:\Dev\Red\build>..\red 
PROGRAM ERROR: Invalid encapsulated data. 

C:\Dev\Red\build>..\red.exe 

-=== Red Console alpha version ===- 
(only ASCII input supported) 

red>>

@hostilefork
Copy link

This appears to be an issue with the encapper not being able to gracefully handle cases where it is not invoked via a fully specified path.

It should have been able to use system/options/boot to do this without error, but... Rebol 2 and its encapper are not open source. So unless it is hacked...or its requests to the filesystem hooked somehow... a simple workaround would be to invoke red through a batch file, which forces a fully specified path.

To do that: rename red.exe to red-exe.exe, and in the same directory as that executable put a red.bat file containing the following line:

"%~dp0red-exe.exe" %*

Moving the exe out of the way means the batch file will be preferred. The quotes sanitize the path, which uses the cryptic %~dp0 to get the path (no close percent used, unlike envrionment variables). The %* is a construct for taking the individual arguments, e.g. %1 %2 ... %n.

@dockimbel
Copy link
Member

Thanks a lot @hostilefork.

@AJMansfield
Copy link

I had this same issue when I was trying to get sublime text to use red as a build system on Ubuntu 15.04.
My solution was similar; I created a shell script like this:

#!/bin/bash
red $@

and called that instead.

@cdokolas
Copy link

For the Windows batch file, I'd add a @ in front, like this:

@"%~dp0red-exe.exe" %*

The way I've actually used it is by dropping the executable to my C:\Utils\ folder (it's in the PATH variable) and also creating a red.bat file there with @"%~dp0red-063.exe" %* in it (I kept the original filename to keep track of the version I'm using).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status.resolved Issue has been resolved without a change in the source code (should be elaborated in comments).
Projects
None yet
Development

No branches or pull requests

5 participants