#include "StdAfx.h"
#include "Path.h"

#include <C2/util/string_converter.h>

using namespace std;



namespace lib_geo
{


std::string Path::GetParentDirPath(const std::string& filename)
{
	wstring wf;
	util::string::ToUnicode(filename, wf);

	size_t i_bs = wf.find_last_of( L'\\' );

	if( i_bs == wstring::npos )
		i_bs = wf.find_last_of( L'/' );

	wstring wd = L"";
	if( i_bs != wstring::npos )
		wd = wf.substr( 0 , i_bs + 1 );

	string dst;
	util::string::ToMultiByte(wd, dst);

	return dst;
}


}
