Changeset 129 for trunk/foundation/class_c/nomfilepath.c
- Timestamp:
- Dec 1, 2006, 6:12:24 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/foundation/class_c/nomfilepath.c
r128 r129 13 13 14 14 #include "nomfilepath.ih" 15 /* 16 Append a path to the string. A path separator will be added to the current path if necessary and the 17 given string appended. If the given string starts with a separator no additional separator will be 18 added to the path prior to appending. If the given string starts with a separator and the current 19 path ends with a separator the ending separator will be removed before appending. 15 20 21 Note that there's no check if the input string is an absolute path. So if an absolute path is given as 22 input the resulting path may not be valid. 23 24 The method returns the NOMPath instance after appending. 25 */ 16 26 NOM_Scope PNOMPath NOMLINK impl_NOMPath_appendPath(NOMPath* nomSelf, const PNOMPath nomPath, CORBA_Environment *ev) 17 27 { 18 /* NOMFilePathData* nomThis=NOMFilePathGetData(nomSelf); */ 19 #warning !!!!! NOMPath_appendPath() is a stub !!!!! 20 NOMPath_appendString((NOMString*) nomSelf, (NOMString*)nomPath, NULLHANDLE); 28 gchar* chrTemp; 29 30 if(!nomPath) 31 return nomSelf; 32 33 if(0==NOMPath_length((NOMString*)nomPath, ev)) 34 return NOMPath_appendSeparator(nomSelf, ev); 35 36 if(G_DIR_SEPARATOR==chrTemp[0]) 37 NOMPath_stripSeparator(nomSelf, ev); 38 else 39 NOMPath_appendSeparator(nomSelf, ev); /* Make sure current path has a separator */ 40 41 return (NOMPath*) NOMPath_appendString((NOMString*) nomSelf, (NOMString*)nomPath, NULLHANDLE); 42 } 43 44 /* 45 Append a separator to the path. If the path already has a separator at the end this method does 46 nothing other than returning the path. 47 */ 48 NOM_Scope PNOMPath NOMLINK impl_NOMPath_appendSeparator(NOMPath* nomSelf, CORBA_Environment *ev) 49 { 50 gchar* chrTemp; 51 gulong len; 52 53 if((len=NOMPath_length((NOMString*)nomSelf, ev))==0) 54 return (NOMPath*)NOMPath_appendCString((NOMString*)nomSelf, G_DIR_SEPARATOR_S, ev); 55 56 if(G_DIR_SEPARATOR!=chrTemp[len-1]) 57 return (NOMPath*)NOMPath_appendCString( (NOMString*)nomSelf, G_DIR_SEPARATOR_S, ev); 58 21 59 return nomSelf; 22 60 } 23 61 62 /* 63 Strips the path separator from the end of a path if there's one. 64 */ 65 NOM_Scope PNOMPath NOMLINK impl_NOMPath_stripSeparator(NOMPath* nomSelf, CORBA_Environment *ev) 66 { 67 gchar* chrTemp; 68 gulong len; 69 70 if((len=NOMPath_length((NOMString*)nomSelf, ev))==0) 71 return nomSelf; 72 73 chrTemp=NOMPath_getCString((NOMString*)nomSelf, ev); 74 if(chrTemp[len-1]==G_DIR_SEPARATOR) 75 return (NOMPath*)NOMPath_truncateString( (NOMString*)nomSelf, len-1, ev); 76 77 return nomSelf; 78 }
Note:
See TracChangeset
for help on using the changeset viewer.