source: NonGTP/FCollada/FUtils/FUFileManager.h @ 964

Revision 964, 1.6 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5/*
6        Based on the FS Import classes:
7        Copyright (C) 2005-2006 Feeling Software Inc
8        Copyright (C) 2005-2006 Autodesk Media Entertainment
9        MIT License: http://www.opensource.org/licenses/mit-license.php
10*/
11
12#ifndef _FU_FILE_MANAGER_H_
13#define _FU_FILE_MANAGER_H_
14
15class FUFile;
16
17class FCOLLADA_EXPORT FUFileManager
18{
19private:
20        FStringList pathStack;
21
22public:
23        FUFileManager();
24        ~FUFileManager();
25
26        // Root path stack
27        const fstring& GetCurrentPath() { return pathStack.back(); }
28        void PushRootPath(const fstring& path);
29        void PopRootPath();
30        void PushRootFile(const fstring& filename);
31        void PopRootFile();
32
33        // Some file access
34        FUFile* OpenFile(const fstring& filename, bool write=true);
35
36        // Extract information from filenames
37        static fstring StripFileFromPath(const fstring& filename);
38        static fstring GetFileExtension(const fstring& filename);
39
40        // Make a file path relative/absolute
41        fstring MakeFilePathAbsolute(const fstring& filePath);
42        fstring MakeFilePathRelative(const fstring& filePath);
43
44        // Transform a file URL into a file path
45        fstring GetFilePath(const fstring& fileURL);
46
47        // Transform a file path into a file URL
48        fstring GetFileURL(const fstring& filepath, bool relative);
49
50        // For a relative path, extract the list of the individual paths that must be traversed to get to the file.
51        static void ExtractPathStack(const fstring& filename, FStringList& list, bool includeFilename);
52};
53
54#endif // _FU_FILE_MANAGER_H_
55
Note: See TracBrowser for help on using the repository browser.