Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

SVN-HEAD binaries download

<< < (8/18) > >>

mandrav:

--- Quote from: mispunt on December 06, 2005, 10:45:58 am ---It shouldn't be that hard to change it, if there is a possibility to find which command to use (command or cmd) then it is very easy..

--- End quote ---

No, it's not. It just needs some time which I don't have. If you can fix it, please do so :)
It's in plugins/compilergcc/compilergcc.cpp:773.

killerbot:
Idea : you can either check the windows version or ....
in the windows system dir (C:\windows\system32 ) , don't remember if that exist on windows 98/SE/95 (well first part can be obtained from environment settings : windir or SystemRoot) you can check if exist :
  - cmd.exe
then use it, if not check if exist :
  - command.com
and then use that one.
If none exist, show dialog box instructing the user to :
 - log out
 - format c:
 - install linux


Cheers,
Lieven

David Perfors:
it is easy ;)

--- Code: ---        if(wxGetOsVersion() == wxWIN95)
            cmd->command = _T("command /c ") + cmd->command;
        else
            cmd->command = _T("cmd /c ") + cmd->command;

--- End code ---
I didn't test it on win98, but it works on XP

Urxae:
[I typed this before the last two posts, but I think my solution is better and cleaner, so here it is]


--- Quote from: mandrav on December 06, 2005, 10:43:06 am ---
--- Quote from: C::B sources ---
--- Code: ---    // TODO (mandrav#1#): Check windows version and substitute cmd.exe with command.com if needed.
        cmd->command = _T("cmd /c ") + cmd->command;

--- End code ---

--- End quote ---

--- End quote ---

More complete code sample:

--- Code: ---    // special shell used only for build commands
    if (!cmd->isRun)
    {
    #ifndef __WXMSW__
        // run the command in a shell, so backtick'd expressions can be evaluated
        cmd->command = GetConsoleShell() + _T(" '") + cmd->command + _T("'");
    #else
    // TODO (mandrav#1#): Check windows version and substitute cmd.exe with command.com if needed.
        cmd->command = _T("cmd /c ") + cmd->command;
    #endif
    }
--- End code ---

I saw that change a while back, and I was wondering: Is there any particular reason "cmd /c " is prepended at all? Shouldn't it "just work" if you that wasn't done?

I see that according to the comments the reason a shell is prepended is to allow backticked expressions to execute, but I'm not aware of any windows version where that works (it's different for *nix of course). It certainly doesn't work in my win2000 cmd.exe...

I think this code should have the exact same effect, except it on win9x where it actually works now ;):

--- Code: ---#ifndef __WXMSW__
    // special shell used only for build commands
    if (!cmd->isRun)
    {
        // run the command in a shell, so backtick'd expressions can be evaluated
        cmd->command = GetConsoleShell() + _T(" '") + cmd->command + _T("'");
    }
#endif

--- End code ---

mandrav:

--- Quote from: Urxae on December 06, 2005, 11:17:38 am ---I saw that change a while back, and I was wondering: Is there any particular reason "cmd /c " is prepended at all? Shouldn't it "just work" if you that wasn't done?

I see that according to the comments the reason a shell is prepended is to allow backticked expressions to execute, but I'm not aware of any windows version where that works (it's different for *nix of course). It certainly doesn't work in my win2000 cmd.exe...

--- End quote ---

Yes, you 're right. The comment does not explain the reasoning for this change.
This was added to allow builtin shell commands to be used in pre-build and post-build steps, i.e. cp, del, etc. These do not work if not invoked within a shell.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version