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 lib_reflect.c,1.47,1.48


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine lib_reflect.c,1.47,1.48
Date: Wed, 13 Aug 2003 17:43:05 -0400

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

Modified Files:
        lib_reflect.c 
Log Message:


"Assembly.GetLocation" should return the full pathname for the assembly,
not just the directory.


Index: lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** lib_reflect.c       12 Aug 2003 07:38:32 -0000      1.47
--- lib_reflect.c       13 Aug 2003 21:43:03 -0000      1.48
***************
*** 1027,1080 ****
   * private String GetLocation();
   */
! ILString *_IL_Assembly_GetLocation(ILExecThread *thread,
!                                         ILObject *_this)
  {
!       ILString *retval;
!       ILProgramItem *item;
!       ILImage *image;
!       char *path;
!       int len;
! 
!       /* Bail out we have no filename to work with */
!       if (!(item = (ILProgramItem *)_ILClrFromObject(thread, _this)))
        {
!               return 0;
!       }
!       if (!(image = ILProgramItem_Image(item)))
!       {
!               return 0;
!       }
!       if(!(image->filename))
!       {
!               return 0;
!       }
! 
!       /* Strip the base name off the image's filename */
!       len = strlen(image->filename);
!       while(len > 0 &&
!             image->filename[len-1] != '/' &&
!             image->filename[len-1] != '\\')
!       {
!               --len;
!       }
! 
!       /* Bail out we have an empty path */
!       if (!len)
!       {
!               return 0;
        }
! 
!       /* Construct the path */
!       if(!(path = (char *)ILMalloc(len+1)))
        {
-               ILExecThreadThrowOutOfMemory(thread);
                return 0;
        }
-       strncpy(path, image->filename, len);
-       retval = ILStringCreate(thread, path);
-       ILFree(path);
- 
-       /* Return the path to the caller */
-       return retval;
  }
  
--- 1027,1042 ----
   * private String GetLocation();
   */
! ILString *_IL_Assembly_GetLocation(ILExecThread *thread, ILObject *_this)
  {
!       ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(thread, _this);
!       ILImage *image = ((item != 0) ? ILProgramItem_Image(item) : 0);
!       if(image)
        {
!               return ILStringCreate(thread, image->filename);
        }
!       else
        {
                return 0;
        }
  }
  





reply via email to

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