MCPcopy Create free account
hub / github.com/TASEmulators/fceux / getFileBaseName

Function getFileBaseName

src/drivers/Qt/ConsoleUtilities.cpp:117–161  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Return file base name stripping out preceding path and trailing suffix.

Source from the content-addressed store, hash-verified

115//---------------------------------------------------------------------------
116// Return file base name stripping out preceding path and trailing suffix.
117int getFileBaseName( const char *filepath, char *base, char *suffix )
118{
119 int i=0,j=0,end=0;
120
121 if ( suffix != NULL )
122 {
123 suffix[0] = 0;
124 }
125 if ( filepath == NULL )
126 {
127 base[0] = 0;
128 return 0;
129 }
130 i=0; j=0;
131 while ( filepath[i] != 0 )
132 {
133 if ( (filepath[i] == '/') || (filepath[i] == '\\') )
134 {
135 j = i+1;
136 }
137 i++;
138 }
139 i = j;
140
141 j=0;
142 while ( filepath[i] != 0 )
143 {
144 base[j] = filepath[i]; i++; j++;
145 }
146 base[j] = 0; end=j;
147
148 while ( j > 1 )
149 {
150 j--;
151 if ( base[j] == '.' )
152 {
153 if ( suffix != NULL )
154 {
155 strcpy( suffix, &base[j] );
156 }
157 end=j; base[j] = 0; break;
158 }
159 }
160 return end;
161}
162//---------------------------------------------------------------------------
163int parseFilepath( const char *filepath, std::string *dir, std::string *base, std::string *suffix )
164{

Callers 15

loadFromFileMethod · 0.85
saveToFileMethod · 0.85
saveCheatFileMethod · 0.85
FCEUD_OpenArchiveFunction · 0.85
saveInputSettingsToFileFunction · 0.85
aviRecordOpenFileFunction · 0.85
aviRecordAsStartMethod · 0.85
wavRecordStartMethod · 0.85
wavRecordAsStartMethod · 0.85
saveProjectAsMethod · 0.85
openProjectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected