~ubuntu-branches/ubuntu/maverick/openturns/maverick

« back to all changes in this revision

Viewing changes to lib/src/Base/Common/Path.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-05-10 17:27:55 UTC
  • mfrom: (1.1.4 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100510172755-cb5ynskknqqi5rhp
Tags: 0.13.2-2ubuntu1
* Merge with Debian testing. No changes left.
* ubuntu_fix-python-2.6.patch: fix detection of python 2.6 libs, to not use
  LOCALMODLIBS. This pulls a dependency on SSL and makes the package FTBFS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *  @file  Path.hxx
4
4
 *  @brief This class provides all the mechanism of path manipulation
5
5
 *
6
 
 *  (C) Copyright 2005-2007 EDF-EADS-Phimeca
 
6
 *  (C) Copyright 2005-2010 EDF-EADS-Phimeca
7
7
 *
8
8
 *  This library is free software; you can redistribute it and/or
9
9
 *  modify it under the terms of the GNU Lesser General Public
20
20
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21
21
 *
22
22
 *  @author: $LastChangedBy: dutka $
23
 
 *  @date:   $LastChangedDate: 2009-06-15 16:14:58 +0200 (lun. 15 juin 2009) $
24
 
 *  Id:      $Id: Path.hxx 1272 2009-06-15 14:14:58Z dutka $
 
23
 *  @date:   $LastChangedDate: 2010-02-04 16:44:49 +0100 (jeu. 04 févr. 2010) $
 
24
 *  Id:      $Id: Path.hxx 1473 2010-02-04 15:44:49Z dutka $
25
25
 */
26
26
#ifndef OPENTURNS_PATH_HXX
27
27
#define OPENTURNS_PATH_HXX
42
42
 
43
43
      /**
44
44
       * @class Path
 
45
       * @brief Provides mechanism for path manipulation
45
46
       *
46
 
       * This class provides all the mechanism of path manipulation
 
47
       * The class defines the search algorithms used to find a file or a directory
 
48
       * through the filesystem. It also defines the standard hardcoded paths and the
 
49
       * way temporary files are built.
47
50
       */
48
51
 
49
52
      class Path
52
55
 
53
56
        typedef std::vector<FileName> DirectoryList;
54
57
 
 
58
        /** 
 
59
         * Return the Open TURNS prefix 
 
60
         *
 
61
         * The search rule is: check the following paths, in that order:
 
62
         *    + if the env var OPENTURNS_HOME exists, return ${OPENTURNS_HOME} if it exists and is a 
 
63
         *      directory,
 
64
         *    + otherwise return the installation path ${prefix}, where 'prefix' is the installation path 
 
65
         *      of the platform as provided at configuration time.
 
66
         */
 
67
        static FileName GetInstallationDirectory();
 
68
 
 
69
        /**
 
70
         * Return the path of the module standard directory 
 
71
         *
 
72
         * The search rule is: check the following paths, in that order:
 
73
         *    + if the env var OPENTURNS_HOME exists, return ${OPENTURNS_HOME}/lib/openturns/module if it 
 
74
         *      exists and is a directory,
 
75
         *    + otherwise return the installation path ${prefix}/lib/openturns/module, where 'prefix' is 
 
76
         *      the installation path of the platform as provided at configuration time.
 
77
         */
 
78
        static FileName GetModuleDirectory();
 
79
 
55
80
        /**
56
81
         * Analyse the process environment and return the directory where
57
82
         * installed wrappers and DTD are.
92
117
        static DirectoryList GetConfigDirectoryList();
93
118
 
94
119
        /**
95
 
         * Find a file named 'name' located in one of the directories
96
 
         * listed in 'dirList'. The function returns the full path (directory/name)
 
120
         * Find a file named \em name located in one of the directories
 
121
         * listed in \em dirList. The function returns the full path (directory/name)
97
122
         * of the first match.
98
123
         */
99
 
        static FileName FindFileByNameInDirectoryList(const FileName & name, const DirectoryList & dirList)
100
 
          throw(FileNotFoundException);
101
 
 
102
 
        /** Build a temporary file name given a pattern */
103
 
        static String BuildTemporaryFileName(const String & pattern);
 
124
        static FileName FindFileByNameInDirectoryList(const FileName & name,
 
125
                                                      const DirectoryList & dirList)
 
126
          /* throw(FileNotFoundException) */;
 
127
 
 
128
        /** Build a temporary file name given a pattern
 
129
         * @param pattern A filename containing at least the 'XXXXXX' string
 
130
         * @result A new unique filename based on the \em pattern
 
131
         */
 
132
        static FileName BuildTemporaryFileName(const FileName & pattern);
 
133
 
 
134
        /** Create a temporary directory.
 
135
         */
 
136
        static FileName CreateTemporaryDirectory(const FileName & directoryPrefix);
 
137
 
 
138
        /** Delete a temporary directory 
 
139
         */
 
140
        static void DeleteTemporaryDirectory(const FileName & directoryName);
104
141
 
105
142
 
106
143
      protected:
147
184
         */
148
185
        static const String PrefixConfigSubdirectory_;
149
186
 
 
187
        /**
 
188
         * @var static const String Path:PrefixModuleSubdirectory_:
 
189
         *
 
190
         * The 'prefix' subdirectory path
 
191
         */
 
192
        static const String PrefixModuleSubdirectory_;
 
193
 
 
194
#ifdef WIN32
 
195
        /**  Add windows backslash to filename for compatibility with R. */
 
196
        static void SlashFileName(FileName & filename);
 
197
#endif
150
198
 
151
199
      public:
152
200
 
153
 
        /** Destructor */
154
 
        virtual ~Path();
155
 
 
156
201
      protected:
157
202
 
158
203
      private: