00001 00002 // exotkUtils_OSD.cxx 00004 // Copyright (C) 2001 Stephane Routelous 00005 // 00006 // This file is part of exoTK. 00007 // 00008 // exoTK is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // exoTK is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with exoTK; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00029 #include <exotkUtils_OSD.hxx> 00030 #ifndef _OSD_Environment_HeaderFile 00031 #include <OSD_Environment.hxx> 00032 #endif 00033 #include <io.h> 00034 00035 00036 //================================================================================== 00037 // Function name : exotkUtils_OSD::AddEnvironmentVariable 00038 //================================================================================== 00039 // Written by : Stephane Routelous - 2001-11-08 19:02:43 00040 // Description : 00041 // Return type : Standard_Boolean 00042 //================================================================================== 00043 // Argument : const TCollection_AsciiString& aName 00044 // Argument : const TCollection_AsciiString& aValue 00045 Standard_Boolean exotkUtils_OSD::AddEnvironmentVariable(const TCollection_AsciiString& aName,const TCollection_AsciiString& aValue) 00046 { 00047 Standard_Boolean success = Standard_False; 00048 if ( !aValue.IsEmpty() ) 00049 { 00050 try 00051 { 00052 OSD_Environment theEnvVariable(aName,aValue); 00053 theEnvVariable.Build(); 00054 success = Standard_True; 00055 } 00056 catch(Standard_Failure) 00057 { 00058 success = Standard_False; 00059 } 00060 catch(...) 00061 { 00062 success = Standard_False; 00063 } 00064 } 00065 return success; 00066 } 00067 00068 Standard_Boolean exotkUtils_OSD::FileExists(const TCollection_AsciiString &aFileToTest) 00069 { 00070 return ( _access(aFileToTest.ToCString(),0 ) != -1 ); 00071 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001