Back to index

salome-kernel  6.5.0
Basics_DirUtils.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 //  SALOME Utils : general SALOME's definitions and tools
00021 //  File   : Basics_DirUtils.hxx
00022 //  Autor  : Alexander A. BORODIN
00023 //  Module : SALOME
00024 //
00025 #ifndef _Basics_DIRUTILS_HXX_
00026 #define _Basics_DIRUTILS_HXX_
00027 
00028 #include "SALOME_Basics.hxx"
00029 
00030 #include <string>
00031 
00032 namespace Kernel_Utils
00033 {
00034   // Extracts and returns the base name of the specified file name.
00035   BASICS_EXPORT std::string GetBaseName( const std::string& file_path );
00036 
00037   // Extracts and returns the dir name of the specified file name.
00038   BASICS_EXPORT std::string GetDirName( const std::string& file_path );
00039 
00040   // Returns the unique temporary directory, that is defined in tmp_path_env if this variable is set
00041   // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
00042   BASICS_EXPORT std::string GetTmpDirByEnv( const std::string& tmp_path_env );
00043 
00044   // Returns the unique temporary directory, that is defined in tmp_path if this variable is set
00045   // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
00046   BASICS_EXPORT std::string GetTmpDirByPath( const std::string& tmp_path );
00047   
00048   // Returns the unique temporary directory in 
00049   // /tmp/something/ for Unix or c:\something\ for WIN32
00050   BASICS_EXPORT std::string GetTmpDir();
00051 
00052 
00053   // Returns the unique temporary file name without any extension
00054   // /tmp/something/file for Unix or c:\something\file for WIN32
00055   BASICS_EXPORT std::string GetTmpFileName();
00056 
00057   // Returns True(False) if the path (not)exists
00058   BASICS_EXPORT bool IsExists( const std::string& path );
00059 
00060   // Returns True(False) if the path is writable
00061   BASICS_EXPORT bool IsWritable( const std::string& path );
00062 
00063   // Returns directory by path and converts it to native system format
00064   BASICS_EXPORT std::string GetDirByPath( const std::string& path );
00065 
00066   // Returns True(False) if the path (not) empty
00067   // Also returns False if the path is not valid
00068   BASICS_EXPORT bool IsEmptyDir( const std::string& path );
00069 }
00070 
00071 #endif