#else
# ifdef HAVE_VSNPRINTF // This is the secondary method
-# if defined(__CYGWIN__) || defined(_WIN32)
-extern int vsnprintf(char *,unsigned int,const char*,va_list)ETL_NO_THROW;
-# else
-extern int vsnprintf(char *,int,const char*,va_list)ETL_NO_THROW;
-# endif
+ extern int vsnprintf(char *,size_t,const char*,va_list)ETL_NO_THROW;
# endif
#endif
#ifdef WIN32
if(path.size()>=3 && path[1]==':' && (path[2]=='\\' || path[2]=='/'))
return true;
- return false;
-#else
+#endif
if(!path.empty() && path[0]==ETL_DIRECTORY_SEPERATOR)
return true;
return false;
-#endif
}
inline std::string
{
std::string ret;
std::string::const_iterator iter;
-
+
for(iter=path.begin();iter!=path.end();++iter)
{
if(*iter==ETL_DIRECTORY_SEPERATOR)
std::string ret;
while(basename(path)==".")path=dirname(path);
-
+
while(!path.empty())
{
std::string dir(get_root_from_path(path));
- if(dir=="../" && ret.size())
+ if((dir=="../" || dir=="..\\") && ret.size())
{
ret=dirname(ret)+ETL_DIRECTORY_SEPERATOR;
}
- else if(dir!="./" && dir!=".")
+ else if((dir!="./" && dir!=".\\") && dir!=".")
{
ret+=dir;
}
path=remove_root_from_path(path);
}
-
+
// Remove any trailing directory seperators
if(ret.size() && ret[ret.size()-1]==ETL_DIRECTORY_SEPERATOR)
{
absolute_path(std::string path)
{
std::string ret(current_working_directory());
-
+
if(path.empty())
return cleanup_path(ret);
if(is_absolute_path(path))
inline std::string
relative_path(std::string curr_path,std::string dest_path)
-{
+{
// If dest_path is already a relative path,
// then there is no need to do anything.
if(!is_absolute_path(dest_path))
dest_path=absolute_path(dest_path);
else
dest_path=cleanup_path(dest_path);
-
+
if(!is_absolute_path(curr_path))
curr_path=absolute_path(curr_path);
else
{
return basename(dest_path);
}
-
+
while(!dest_path.empty() && !curr_path.empty() && get_root_from_path(dest_path)==get_root_from_path(curr_path))
{
dest_path=remove_root_from_path(dest_path);
while(!curr_path.empty())
{
- dest_path="../"+dest_path;
+ dest_path=std::string("..")+ETL_DIRECTORY_SEPERATOR+dest_path;
curr_path=remove_root_from_path(curr_path);
}
-
+
return dest_path;
}