Esempio n. 1
0
bool FileManager::move(const URL &sSourcePath, const URL &sTargetPath)
{
	if (!isExists(sSourcePath) || !isWritable(URL(sTargetPath).deleteLastPathComponent()))
	{
		SCError("cannot move file %s to %s", sSourcePath.c_str(), sTargetPath.c_str());
		return false;
	}
	
	if (rename(sSourcePath.c_str(), sTargetPath.c_str()) == 0)
	{
		return true;
	}
	SCLog("cannot rename %s to %s, try copying...", sSourcePath.c_str(), sTargetPath.c_str());
	
	// cannot rename, try copy
	if (!copy(sSourcePath, sTargetPath))
	{
		SCError("failed to copy file %s to %s", sSourcePath.c_str(), sTargetPath.c_str());
		return false;
	}
	
	if (!remove(sSourcePath))
	{
		SCWarning("cannot remove old file: %s", sSourcePath.c_str());
		return false;
	}
	
	return true;
}
Esempio n. 2
0
bool Client::openURL(const char * pszURL) const
{
	SCWarning("not implement");
	return true;
}