Skip to content

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

Closed

Description

@SoleSoul

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.

Activity

  1. dockimbel commented on Sep 30, 2013

    @dockimbel
    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>>
    
  2. hostilefork commented on Sep 30, 2013

    @hostilefork

    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.

  3. dockimbel commented on Sep 30, 2013

    @dockimbel
    Member

    Thanks a lot @hostilefork.

  4. AJMansfield commented on Oct 25, 2015

    @AJMansfield

    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.

  5. cdokolas commented on Jul 28, 2017

    @cdokolas

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status.resolvedIssue has been resolved without a change in the source code (should be elaborated in comments).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions