dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/engine ilrun.c,1.25,1.26


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine ilrun.c,1.25,1.26
Date: Mon, 16 Dec 2002 07:14:54 -0500

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv21407/engine

Modified Files:
        ilrun.c 
Log Message:


Automatically append ".exe" to the name of the IL application if it was omitted.


Index: ilrun.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/ilrun.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** ilrun.c     6 Nov 2002 00:14:12 -0000       1.25
--- ilrun.c     16 Dec 2002 12:14:52 -0000      1.26
***************
*** 122,125 ****
--- 122,127 ----
        int sawException;
        int registerMode = 0;
+       char *ilprogram;
+       int ilprogramLen;
  #ifndef IL_CONFIG_REDUCE_CODE
        int dumpInsnProfile = 0;
***************
*** 265,273 ****
        }
  
        /* Attempt to load the program into the process */
!       error = ILExecProcessLoadFile(process, argv[1]);
        if(error < 0)
        {
!               perror(argv[1]);
                return 1;
        }
--- 267,294 ----
        }
  
+       /* Get the name of the IL program, appending ".exe" if necessary */
+       ilprogram = argv[1];
+       ilprogramLen = strlen(ilprogram);
+       if(!ILFileExists(ilprogram, (char **)0) &&
+          (ilprogramLen < 4 ||
+           ILStrICmp(ilprogram + ilprogramLen - 4, ".exe") != 0))
+       {
+               ilprogram = (char *)ILMalloc(ilprogramLen + 5);
+               if(ilprogram)
+               {
+                       strcpy(ilprogram, argv[1]);
+                       strcat(ilprogram, ".exe");
+               }
+               else
+               {
+                       ilprogram = argv[1];
+               }
+       }
+ 
        /* Attempt to load the program into the process */
!       error = ILExecProcessLoadFile(process, ilprogram);
        if(error < 0)
        {
!               perror(ilprogram);
                return 1;
        }
***************
*** 275,279 ****
        {
                /* This is a regular Windows executable */
!       #ifndef _WIN32
                /* Hand the program off to Wine for execution */
                argv[0] = getenv("WINE");
--- 296,301 ----
        {
                /* This is a regular Windows executable */
!               argv[1] = ilprogram;
!       #ifndef IL_WIN32_PLATFORM
                /* Hand the program off to Wine for execution */
                argv[0] = getenv("WINE");
***************
*** 292,296 ****
        else if(error > 0)
        {
!               fprintf(stderr, "%s: %s\n", argv[1], ILImageLoadError(error));
                return 1;
        }
--- 314,318 ----
        else if(error > 0)
        {
!               fprintf(stderr, "%s: %s\n", ilprogram, ILImageLoadError(error));
                return 1;
        }
***************
*** 300,304 ****
        if(!method)
        {
!               fprintf(stderr, "%s: no program entry point\n", argv[1]);
                ILExecProcessDestroy(process);
                return 1;
--- 322,326 ----
        if(!method)
        {
!               fprintf(stderr, "%s: no program entry point\n", ilprogram);
                ILExecProcessDestroy(process);
                return 1;
***************
*** 308,312 ****
        if(ILExecProcessEntryType(method) == IL_ENTRY_INVALID)
        {
!               fprintf(stderr, "%s: invalid entry point\n", argv[1]);
                ILExecProcessDestroy(process);
                return 1;
--- 330,334 ----
        if(ILExecProcessEntryType(method) == IL_ENTRY_INVALID)
        {
!               fprintf(stderr, "%s: invalid entry point\n", ilprogram);
                ILExecProcessDestroy(process);
                return 1;
***************
*** 315,319 ****
        /* Convert the arguments into an array of strings */
        thread = ILExecProcessGetMain(process);
!       args = ILExecProcessSetCommandLine(process, argv[1], argv + 2);
  
        /* Call the entry point */
--- 337,341 ----
        /* Convert the arguments into an array of strings */
        thread = ILExecProcessGetMain(process);
!       args = ILExecProcessSetCommandLine(process, ilprogram, argv + 2);
  
        /* Call the entry point */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]