Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/fileStructure_8doxygen_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:55:47 2014
Кодировка:

Поисковые слова: south pole
Stellarium: /home/aw/devel/stellarium/trunk/doc/fileStructure.doxygen Source File
Stellarium 0.12.3
fileStructure.doxygen
1 /*
2  * Stellarium
3  * Copyright (C) 2009 Matthew Gates
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 *</tt>: landscape textures and data files</li>
68 </ul>
69 
70 </li>
71 </ul>
72 
73 If a file exists in the <em>User Data Directory</em>, it will be used in preference to a file with the same name existing in the <em>Installation Data Directory</em>. This allows users to customise data files, textures and so on without modifying the originally installed files.
74 
75 There are several reasons for doing this:
76 <ul>
77  <li>On machines which multiple user accounts, the <em>Installation Data Directory</em> will likely not be writable by all users. Without allowing the <em>User Data Directory</em> files to over-ride <em>Installation Data Directory</em> files such users could not customise the program without doing an entirely separate installation.</li>
78  <li>On multi-user systems, different users can customise Stellarium without affecting other users of the program.</li>
79  <li>Users who modify files in the <em>Installation Data Directory</em> will likely have their work deleted or overwritten when they upgrade Stellarium. By keeping user-customised files separate from the installation, the upgrade procedure is easier to manage, and users have better security for their work.</li>
80  <li>Users who mess up a customisation attempt need only remove the <em>User Data Directory</em> copy of a file to return to the original (working) copy.</li>
81 </ul>
82 
83 @section findingFile Finding files with the StelFileMgr class
84 
85 Whenever a file is needed in Stellarium, it should be located using the StelFileMgr class. This class will find the file in the first location in the search path. An instance of this class is maintained by the StelApp singleton. StelFileMgr::findFile() will throw exceptions when a problem is encountered, so it is important to always use <tt>try ... catch ...</tt> exception handling when using it.
86 
87 For example. You are writing a class called Comet, and wish to search for a data file called <tt>comets.dat</tt> located in the <tt>data</tt> directory, you would go about it like this:
88 
89 @code
90 QString path;
91 try
92 {
93  path = StelApp::getInstance().getFileMgr().findFile("data/comets.dat");
94 }
95 catch(std::runtime_error& e)
96 {
97  qWarning() << "Could not locate file: data/comets.dat : " << e.what();
98 }
99 ...
100 @endcode
101 
102 As you can see, the file is specified only by the partial path. This partial path is appended first to the <em>User Data Directory</em>. If, and only if the file is not found there, it is searched for in the <em>Installation Data Directory</em>. Thus if the user has a customised copy at: <tt>\<User Data Directory>/data/comets.dat</tt> it will be used, else the version in the <em>Installation Data Directory</em> will be used.
103 
104 @section exampleStarCatalogTool Example: Star Catalogue Download Tool
105 Stellarium ships with the first four star catalogue files of nine files. The implementation of a catalogue downloading tool helps ease the task for users wanting the extra catalogues by automating the download and installation procedure.
106 
107 The files which come with Stellarium are found by the partial paths:
108 @verbatim
109 stars/default/stars_0_0v0_1.cat
110 stars/default/stars_1_0v0_1.cat
111 stars/default/stars_2_0v0_1.cat
112 stars/default/stars_3_1v0_1.cat
113 @endverbatim
114 
115 Naturally, these files are to be located in the <em>Installation Data Directory</em> (because they ship with the installer).
116 
117 The catalogue downloader tool runs within Stellarium. When it downloads extra star catalogue files, it should place them in the <em>User Data Directory</em>. After downloading all the catalogues, the paths to the various files should look like this:
118 
119 @verbatim
120 <Installation Data Directory>/stars/default/stars_0_0v0_1.cat
121 <Installation Data Directory>/stars/default/stars_1_0v0_1.cat
122 <Installation Data Directory>/stars/default/stars_2_0v0_1.cat
123 <Installation Data Directory>/stars/default/stars_3_1v0_1.cat
124 <User Data Directory>/stars/default/stars_4_1v0_0.cat
125 <User Data Directory>/stars/default/stars_5_2v0_0.cat
126 <User Data Directory>/stars/default/stars_6_2v0_0.cat
127 <User Data Directory>/stars/default/stars_7_2v0_0.cat
128 <User Data Directory>/stars/default/stars_8_2v0_0.cat
129 @endverbatim
130 
131 It might be that someone makes a customised installer of Stellarium which includes all the star catalogues with the main installation - perhaps on a special edition DVD. In this case, all the files would be in the <em> \<Installation Data Directory>/stars/default</em> directory. The downloader tool should be able to cope with this, not re-downloading files into the <em>User Data Directory</em> which already reside in the <em>Installation Data Directory</em>.
132 
133 */