Subversion Repositories spk

Rev

Rev 116 | Rev 125 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 116 Rev 121
Line 158... Line 158...
158
		case FILETYPE_MISSION:
158
		case FILETYPE_MISSION:
159
			return "Director";
159
			return "Director";
160
	}
160
	}
161
	return NullString;
161
	return NullString;
162
}
162
}
-
 
163
 
-
 
164
Utils::String C_File::getDirectory(CBaseFile *file) const
-
 
165
{
-
 
166
	if (IsFakePatch())
-
 
167
		return "";
-
 
168
 
-
 
169
	Utils::String sDir = m_sDir.ToString();
-
 
170
 
-
 
171
	if ((m_iFileType == FILETYPE_MOD) && (sDir == "Patch"))
-
 
172
		return "PluginManager/Patch";
-
 
173
 
-
 
174
	if ((!sDir.empty()) && (m_iFileType != FILETYPE_README) && sDir != ".")
-
 
175
	{
-
 
176
		Utils::String dir = sDir.findReplace("\\", "/");
-
 
177
		if (file)
-
 
178
		{
-
 
179
			dir = dir.findReplace("$scriptname", file->GetNameValidFile().ToString());
-
 
180
			dir = dir.findReplace("$scriptauthor", file->author());
-
 
181
		}
-
 
182
		return dir;
-
 
183
	}
-
 
184
 
-
 
185
	switch (m_iFileType)
-
 
186
	{
-
 
187
	case FILETYPE_SCRIPT:
-
 
188
		return "Scripts";
-
 
189
	case FILETYPE_TEXT:
-
 
190
		return "T";
-
 
191
	case FILETYPE_README:
-
 
192
	{
-
 
193
		if (file)
-
 
194
			return Utils::String("PluginManager/Readme/") + file->GetNameValidFile().ToString();
-
 
195
		return "PluginManager/Readme";
-
 
196
	}
-
 
197
	case FILETYPE_MAP:
-
 
198
		return "Maps";
-
 
199
	case FILETYPE_MOD:
-
 
200
		//			if ( (file) && (file->IsPatch()) )
-
 
201
		//				return "Mods/Patch";
-
 
202
		return "Mods";
-
 
203
	case FILETYPE_UNINSTALL:
-
 
204
		return "PluginManager/Uninstall";
-
 
205
	case FILETYPE_SOUND:
-
 
206
		if (CFileIO(m_sName).CheckFileExtension("wav"))
-
 
207
			return "s";
-
 
208
		return "Soundtrack";
-
 
209
	case FILETYPE_EXTRA:
-
 
210
		return "PluginManager/Extras";
-
 
211
	case FILETYPE_SCREEN:
-
 
212
		return "loadscr";
-
 
213
	case FILETYPE_ADVERT:
-
 
214
		return "PluginManager/Graphics";
-
 
215
	case FILETYPE_MISSION:
-
 
216
		return "Director";
-
 
217
	}
-
 
218
	return Utils::String::Null();
-
 
219
}
-
 
220
 
163
 
221
 
164
CyString C_File::GetNameDirectory ( CBaseFile *file )
222
CyString C_File::GetNameDirectory ( CBaseFile *file )
165
{
223
{
166
	CyString dir = GetDirectory( file );
224
	CyString dir = GetDirectory( file );
167
	if ( !dir.Empty() )
225
	if ( !dir.Empty() )
Line 298... Line 356...
298
	}
356
	}
299
 
357
 
300
	return false;
358
	return false;
301
}
359
}
302
 
360
 
303
bool C_File::IsFakePatch ()
361
bool C_File::IsFakePatch() const
304
{
362
{
305
	if ( m_iFileType != FILETYPE_MOD )
363
	if (m_iFileType != FILETYPE_MOD)
306
		return false;
364
		return false;
307
 
365
 
-
 
366
	Utils::String name = m_sName.ToString();
-
 
367
 
308
	if ( m_sName.GetToken ( 1, '.' ).ToInt() )
368
	if (name.token(".", 1).toLong())
309
		return true;
369
		return true;
310
 
370
 
311
	if ( m_sName.Left (10) == ";FakePatch_" )
371
	if (name.left(10) == ";FakePatch_")
312
		return true;
372
		return true;
313
 
373
 
314
	return false;
374
	return false;
315
}
375
}
316
 
376