Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Directory.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Directory.cc (C) 2000-2010 */
9/* */
10/* Gestion d'un répertoire. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/String.h"
17#include "arcane/utils/StringBuilder.h"
18#include "arcane/utils/Iostream.h"
19#include "arcane/utils/PlatformUtils.h"
20
21#include "arcane/Directory.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26ARCANE_BEGIN_NAMESPACE
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31static String
32_appendFile(const String& directory,const String& file)
33{
34 StringBuilder out_str(directory);
35#ifdef ARCANE_OS_WIN32
36 out_str += "\\";
37#else /* ARCANE_OS_WIN32 */
38 out_str += "/";
39#endif /* ARCANE_OS_WIN32 */
40 out_str += file;
41 return out_str.toString();
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47Directory::
48Directory()
49{
50}
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
55Directory::
56Directory(const String& path)
57: m_directory_path(path)
58{
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64Directory::
65Directory(const IDirectory& directory,const String& sub_path)
66: m_directory_path(_appendFile(directory.path(),sub_path))
67{
68}
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
73Directory::
74Directory(const IDirectory& directory)
75: m_directory_path(directory.path())
76{
77}
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82Directory::
83Directory(const Directory& directory)
84: m_directory_path(directory.path())
85{
86}
87
88/*---------------------------------------------------------------------------*/
89/*---------------------------------------------------------------------------*/
90
91Directory::
92~Directory()
93{
94}
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99const Directory& Directory::
100operator=(const IDirectory& from)
101{
102 m_directory_path = from.path();
103 return (*this);
104}
105
106/*---------------------------------------------------------------------------*/
107/*---------------------------------------------------------------------------*/
108
109const Directory& Directory::
110operator=(const Directory& from)
111{
112 m_directory_path = from.m_directory_path;
113 return (*this);
114}
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119bool Directory::
120createDirectory() const
121{
122 return platform::createDirectory(m_directory_path);
123}
124
125/*---------------------------------------------------------------------------*/
126/*---------------------------------------------------------------------------*/
127
128String Directory::
129path() const
130{
131 return m_directory_path;
132}
133
134/*---------------------------------------------------------------------------*/
135/*---------------------------------------------------------------------------*/
136
137String Directory::
138file(const String& file_name) const
139{
140 return _appendFile(path(),file_name);
141}
142
143/*---------------------------------------------------------------------------*/
144/*---------------------------------------------------------------------------*/
145
146ARCANE_END_NAMESPACE
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
Classe gérant un répertoire.
Definition Directory.h:33
Interface d'une classe gérant un répertoire.
Definition IDirectory.h:31
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Chaîne de caractères unicode.