00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "freFileDispatch.h"
00024
00025 #include "itksys/SystemTools.hxx"
00026
00027 namespace FREE
00028 {
00029 std::string
00030 FileDispatch::
00031 GetName(const std::string& sFilePath)
00032 {
00033 std::string result = itksys::SystemTools::GetFilenameWithoutLastExtension(sFilePath);
00034 return result;
00035 };
00036
00037 std::string
00038 FileDispatch::
00039 GetExtension(const std::string& sFilePath)
00040 {
00041 std::string result = itksys::SystemTools::GetFilenameLastExtension(sFilePath);
00042 return result;
00043 };
00044
00045 std::string
00046 FileDispatch::
00047 GetFullName(const std::string& sFilePath)
00048 {
00049 std::string result = itksys::SystemTools::GetFilenameName(sFilePath);
00050 return result;
00051 };
00052
00053 std::string
00054 FileDispatch::
00055 GetPath(const std::string& sFilePath)
00056 {
00057 std::string result = itksys::SystemTools::GetFilenamePath(sFilePath);
00058 return result;
00059
00060 };
00061
00062 std::string
00063 FileDispatch::
00064 GetName()
00065 {
00066 return GetName(m_sFileName);
00067 };
00068
00069 std::string
00070 FileDispatch::
00071 GetExtension()
00072 {
00073 return GetExtension(m_sFileName);
00074 };
00075
00076 std::string
00077 FileDispatch::
00078 GetFullName()
00079 {
00080 return GetFullName(m_sFileName);
00081 };
00082
00083 std::string
00084 FileDispatch::
00085 GetPath()
00086 {
00087 return GetPath(m_sFileName);
00088 };
00089
00090 FileDispatch::
00091 FileDispatch(const std::string& sFilePath)
00092 {
00093 m_sFileName = sFilePath;
00094 };
00095
00100 std::string
00101 FileDispatch::
00102 CreateFullPath(const char* path, const char* file)
00103 {
00104 std::string ret;
00105
00106 #ifdef _WIN32
00107 const char sep = '\\';
00108 #else
00109 const char sep = '/';
00110 #endif
00111
00114 ret = path;
00115 if ( ret[ret.size()-1] != sep )
00116 {
00117 ret.append(1, sep);
00118 }
00119 ret.append(file);
00120 return ret;
00121 }
00122 }