source: branches/work_304/FileSystemUtil.h @ 328

Revision 328, 7.1 KB checked in by jls17, 6 years ago (diff)
Line 
1//Copyright (C) 2009 Stefan Nerlich | stefan.nerlich@hotmail.com
2//
3//This file is part of ARInside.
4//
5//    ARInside is free software: you can redistribute it and/or modify
6//    it under the terms of the GNU General Public License as published by
7//    the Free Software Foundation, version 2 of the License.
8//
9//    ARInside is distributed in the hope that it will be useful,
10//    but WITHOUT ANY WARRANTY; without even the implied warranty of
11//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12//    GNU General Public License for more details.
13//
14//    You should have received a copy of the GNU General Public License
15//    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
16
17#pragma once
18#include "AppConfig.h"
19
20#ifdef WIN32
21#define ARINSIDE_PATH_SEPARATOR "\\"
22#else
23#define ARINSIDE_PATH_SEPARATOR "/"
24#endif
25
26class FileSystemUtil
27{
28public:
29        FileSystemUtil(AppConfig &appConfig);
30        ~FileSystemUtil(void);
31
32        void Load();
33        bool CreateAppDirectory();
34        int CreateSubDirectory(string name);
35
36        static int ValidateTargetDir(std::string targetFolder);
37        static std::string GetRealPathName(const std::string &path);
38        static bool FileExistsAndReadable(const std::string &filename);
39        static bool DeleteDirectory(const char* sPath, bool topLevel = true);
40        static bool IsDots(const char* str);
41        static void CompactFolder(std::string path);
42        static std::string GetExecutableDirectory(const char* argv_0);
43        static std::string CombinePath(const std::string &path1, const std::string &path2);
44#if WIN32
45        static std::string GetFormattedMessage(unsigned int error);
46#endif
47
48private:
49        void LoadFromResource(unsigned int res, string fileName, string path);
50        AppConfig &appConfig;
51};
52
53#ifndef WIN32
54        // the following symbols are generated by CMakeList.txt
55        extern unsigned char _binary_res_active_link_gif_start[];       extern unsigned int _binary_res_active_link_gif_size;
56        extern unsigned char _binary_res_al_guide_gif_start[]; extern unsigned int _binary_res_al_guide_gif_size;
57        extern unsigned char _binary_res_application_gif_start[]; extern unsigned int _binary_res_application_gif_size;
58        extern unsigned char _binary_res_ars_edit_gif_start[]; extern unsigned int _binary_res_ars_edit_gif_size;
59        extern unsigned char _binary_res_chapter_gif_start[]; extern unsigned int _binary_res_chapter_gif_size;
60        extern unsigned char _binary_res_disabled_gif_start[]; extern unsigned int _binary_res_disabled_gif_size;
61        extern unsigned char _binary_res_doc_gif_start[]; extern unsigned int _binary_res_doc_gif_size;
62        extern unsigned char _binary_res_down_gif_start[]; extern unsigned int _binary_res_down_gif_size;
63        extern unsigned char _binary_res_down2_gif_start[]; extern unsigned int _binary_res_down2_gif_size;
64        extern unsigned char _binary_res_down2_on_gif_start[]; extern unsigned int _binary_res_down2_on_gif_size;
65        extern unsigned char _binary_res_edit_gif_start[]; extern unsigned int _binary_res_edit_gif_size;
66        extern unsigned char _binary_res_empty_list_gif_start[]; extern unsigned int _binary_res_empty_list_gif_size;
67        extern unsigned char _binary_res_escalation_gif_start[]; extern unsigned int _binary_res_escalation_gif_size;
68        extern unsigned char _binary_res_filter_gif_start[]; extern unsigned int _binary_res_filter_gif_size;
69        extern unsigned char _binary_res_filter_guide_gif_start[]; extern unsigned int _binary_res_filter_guide_gif_size;
70        extern unsigned char _binary_res_folder_gif_start[]; extern unsigned int _binary_res_folder_gif_size;
71        extern unsigned char _binary_res_group_gif_start[]; extern unsigned int _binary_res_group_gif_size;
72        extern unsigned char _binary_res_hidden_gif_start[]; extern unsigned int _binary_res_hidden_gif_size;
73        extern unsigned char _binary_res_image_gif_start[]; extern unsigned int _binary_res_image_gif_size;
74        extern unsigned char _binary_res_info_gif_start[]; extern unsigned int _binary_res_info_gif_size;
75        extern unsigned char _binary_res_menu_gif_start[]; extern unsigned int _binary_res_menu_gif_size;
76        extern unsigned char _binary_res_next_gif_start[]; extern unsigned int _binary_res_next_gif_size;
77        extern unsigned char _binary_res_packing_list_gif_start[]; extern unsigned int _binary_res_packing_list_gif_size;
78        extern unsigned char _binary_res_prev_gif_start[]; extern unsigned int _binary_res_prev_gif_size;
79        extern unsigned char _binary_res_schema_gif_start[]; extern unsigned int _binary_res_schema_gif_size;
80        extern unsigned char _binary_res_script_js_start[]; extern unsigned int _binary_res_script_js_size;
81        extern unsigned char _binary_res_search_gif_start[]; extern unsigned int _binary_res_search_gif_size;
82        extern unsigned char _binary_res_server_gif_start[]; extern unsigned int _binary_res_server_gif_size;
83        extern unsigned char _binary_res_sort_asc_gif_start[]; extern unsigned int _binary_res_sort_asc_gif_size;
84        extern unsigned char _binary_res_sort_desc_gif_start[]; extern unsigned int _binary_res_sort_desc_gif_size;
85        extern unsigned char _binary_res_filtermenu_js_start[]; extern unsigned int _binary_res_filtermenu_js_size;
86        extern unsigned char _binary_res_prototype_js_start[]; extern unsigned int _binary_res_prototype_js_size;
87        extern unsigned char _binary_res_sortscript_js_start[]; extern unsigned int _binary_res_sortscript_js_size;
88        extern unsigned char _binary_res_style_css_start[]; extern unsigned int _binary_res_style_css_size;
89        extern unsigned char _binary_res_tabscript_js_start[]; extern unsigned int _binary_res_tabscript_js_size;
90        extern unsigned char _binary_res_up_gif_start[]; extern unsigned int _binary_res_up_gif_size;
91        extern unsigned char _binary_res_user_gif_start[]; extern unsigned int _binary_res_user_gif_size;
92        extern unsigned char _binary_res_visible_gif_start[]; extern unsigned int _binary_res_visible_gif_size;
93        extern unsigned char _binary_res_webservice_gif_start[]; extern unsigned int _binary_res_webservice_gif_size;
94        extern unsigned char _binary_res_schema_page_js_start[]; extern unsigned int _binary_res_schema_page_js_size;
95        extern unsigned char _binary_thirdparty_jquery_jquery_ui_custom_css_start[]; extern unsigned int _binary_thirdparty_jquery_jquery_ui_custom_css_size;
96        extern unsigned char _binary_thirdparty_jquery_jquery_ui_js_start[]; extern unsigned int _binary_thirdparty_jquery_jquery_ui_js_size;
97        extern unsigned char _binary_thirdparty_jquery_jquery_address_min_js_start[]; extern unsigned int _binary_thirdparty_jquery_jquery_address_min_js_size;
98        extern unsigned char _binary_thirdparty_jquery_jquery_js_start[]; extern unsigned int _binary_thirdparty_jquery_jquery_js_size;
99        extern unsigned char _binary_thirdparty_jquery_jquery_timers_js_start[]; extern unsigned int _binary_thirdparty_jquery_jquery_timers_js_size;
100        extern unsigned char _binary_thirdparty_jquery_images_ui_bg_glass_75_e6e6e6_1x400_png_start[]; extern unsigned int _binary_thirdparty_jquery_images_ui_bg_glass_75_e6e6e6_1x400_png_size;
101        extern unsigned char _binary_thirdparty_jquery_images_ui_bg_glass_65_ffffff_1x400_png_start[]; extern unsigned int _binary_thirdparty_jquery_images_ui_bg_glass_65_ffffff_1x400_png_size;
102        extern unsigned char _binary_res_arshelper_js_start[]; extern unsigned int _binary_res_arshelper_js_size;
103#endif
Note: See TracBrowser for help on using the repository browser.