|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: Creating a Folder shell extension to start an MSYS shellHi, Ok -- I got all the way home, but not in as nice a way as I would have liked: I am using the following for my "command" for my shell extension: cmd.exe /c "C:\MinGW\msys\1.0\msys_jay.bat -cdopt \"%L\"" I created my own version of msys.bat that allows a "-cdopt" argument. When that is passed, I set a variable MSYSCD to the %L value. Then, in my .profile -- I check whether MSYSCD is set, and if so -- I cd to that directory. The only thing I don't like about it is the changes to .profile, seems like it should not be needed. But ... it gives me what I wanted. Source code: msys_jay.bat: rem @echo off if NOT "x%1" == "x-cdopt" goto _NotCD set MSYSCD=%2 rem -- for %%F in (1 2) do shift :_NotCD if "%1" == "GOTO:" goto %2 if NOT "x%WD%" == "x" set WD= goto _WindowsNT :_Resume rem -- here iff recursion for %%F in (1 2 3) do shift if NOT EXIST %WD%msys-1.0.dll set WD=.\bin\ :_WindowsNT if not "x%PROCESSOR_ARCHITECTURE%" == "xAMD64" goto _NotX64 :_X64 rem get MSYS shell to run on x64 (WoW64 cmd sets PROCESSOR_ARCHITECTURE=x86 => 2nd time goes to _NotX64) set COMSPEC=%WINDIR%\SysWOW64\cmd.exe %COMSPEC% /c %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 goto EOF :_NotX64 if NOT EXIST %WD%msys-1.0.dll set WD=%~dp0\bin\ set MSYSCON=sh.exe set MSYSTEM=MINGW32 if NOT EXIST %WD%sh.exe goto notfound start %WD%sh --login -i exit :notfound echo Cannot find sh.exe binary -- aborting. pause exit 1 :EOF .profile if [ "x$MSYSCD" != "x" ] ; then cd "`msys_cd`" fi msys_cd.c #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char *p_dospath, *p_char; static char new_path[MAX_PATH]; char env_buf[MAX_PATH+4]; int i; p_dospath = getenv("MSYSCD"); if (p_dospath == NULL) { printf("Usage: MSYSCD environmental variable is required\n"); return 1; } /* eg: MSYSCD = \"P:\john\" */ i = strlen(p_dospath); memset(new_path, '\0', sizeof(new_path)); strncpy(new_path, &p_dospath[2], i-3); /* dont copy trailing quote */ printf("%s", new_path); return 0; /* success */ } -Jay -- View this message in context: http://n2.nabble.com/Creating-a-Folder-shell-extension-to-start-an-MSYS-shell-tp3889252p3890213.html Sent from the MinGW-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ MinGW-users mailing list MinGW-users@... This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists. We ask that you be polite and do the same. Most annoying abuses are: 1) Top posting 2) Thread hijacking 3) HTML/MIME encoded mail 4) Improper quoting 5) Improper trimming _______________________________________________ You may change your MinGW Account Options or unsubscribe at: https://lists.sourceforge.net/lists/listinfo/mingw-users |
| Free embeddable forum powered by Nabble | Forum Help |