Subversion Repositories spk

Rev

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

Rev 1 Rev 18
Line 2... Line 2...
2
 
2
 
3
namespace SPK {
3
namespace SPK {
4
	s_int GetAutomaticFiletype(CyString file, CyString *extradir)
4
	s_int GetAutomaticFiletype(CyString file, CyString *extradir, bool bUseSpecial)
5
	{
5
	{
6
		CFileIO File(file);
6
		CFileIO File(file);
7
		CyString dir = File.GetDirIO().TopDir();
7
		CyString dir = File.GetDirIO().TopDir();
8
 
8
 
9
		CyString basename = File.GetBaseName();
9
		CyString basename = File.GetBaseName();
Line 26... Line 26...
26
				type = FILETYPE_TEXT;
26
				type = FILETYPE_TEXT;
27
			else if ( dir.Compare("maps") )
27
			else if ( dir.Compare("maps") )
28
				type = FILETYPE_MAP;
28
				type = FILETYPE_MAP;
29
			else if ( dir.Compare("t") )
29
			else if ( dir.Compare("t") )
30
				type = FILETYPE_TEXT;
30
				type = FILETYPE_TEXT;
-
 
31
			else if ( (bUseSpecial) && (dir.Compare("scripts") && basename.IsIn("uninstall")) )
-
 
32
				type = FILETYPE_SCRIPT_UNINSTALL;
31
			else if ( dir.Compare("uninstall") || basename.IsIn("uninstall") )
33
			else if ( dir.Compare("uninstall") || basename.IsIn("uninstall") )
-
 
34
				type = FILETYPE_UNINSTALL;
-
 
35
			else if ( dir.IsIn("uninstall") )
32
				type = FILETYPE_UNINSTALL;
36
				type = FILETYPE_UNINSTALL;
33
			else if ( dir.Compare("director") )
37
			else if ( dir.Compare("director") )
34
				type = FILETYPE_MISSION;
38
				type = FILETYPE_MISSION;
35
		}
39
		}
36
		// could be a model file or scene file
40
		// could be a model file or scene file
Line 63... Line 67...
63
			type = FILETYPE_ADVERT;
67
			type = FILETYPE_ADVERT;
64
 
68
 
65
		return type;
69
		return type;
66
	}
70
	}
67
 
71
 
-
 
72
	//TODO: check for special types
68
	void AssignAutomaticFiletypes(CyStringList *list)
73
	void AssignAutomaticFiletypes(CyStringList *list)
69
	{
74
	{
70
		for ( SStringList *str = list->Head(); str; str = str->next )
75
		for ( SStringList *str = list->Head(); str; str = str->next )
71
		{
76
		{
72
			CyString extradir;
77
			CyString extradir;
73
			s_int type = SPK::GetAutomaticFiletype(str->str, &extradir);
78
			s_int type = SPK::GetAutomaticFiletype(str->str, &extradir, false);
74
 
79
 
75
			if ( type == FILETYPE_EXTRA && !extradir.Empty() )
80
			if ( type == FILETYPE_EXTRA && !extradir.Empty() )
76
				str->data = CyString::Number(type) + " " + extradir;
81
				str->data = CyString::Number(type) + " " + extradir;
77
			else
82
			else
78
				str->data = CyString::Number(type);
83
				str->data = CyString::Number(type);