mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
Add function PBD::sys::remove as a wrapper to g_unlink
API is intended to be indentical(apart from the string type) to boost::filesystem::remove git-svn-id: svn://localhost/ardour2/trunk@2372 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f9c202dba0
commit
29842063e3
2 changed files with 26 additions and 0 deletions
|
|
@ -94,6 +94,20 @@ create_directories(const path & p)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
remove(const path & p)
|
||||||
|
{
|
||||||
|
if(!exists(p)) return false;
|
||||||
|
|
||||||
|
int error = g_unlink (p.to_string().c_str());
|
||||||
|
|
||||||
|
if(error == -1)
|
||||||
|
{
|
||||||
|
throw filesystem_error(g_strerror(errno), errno);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
basename (const path & p)
|
basename (const path & p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,18 @@ bool create_directory(const path & p);
|
||||||
*/
|
*/
|
||||||
bool create_directories(const path & p);
|
bool create_directories(const path & p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to delete the file at path p as if by the glib function
|
||||||
|
* g_unlink.
|
||||||
|
*
|
||||||
|
* @return true if file existed prior to removing it, false if file
|
||||||
|
* at p did not exist.
|
||||||
|
*
|
||||||
|
* @throw filesystem_error if removing the file failed for any other
|
||||||
|
* reason other than the file did not exist.
|
||||||
|
*/
|
||||||
|
bool remove(const path & p);
|
||||||
|
|
||||||
string basename (const path& p);
|
string basename (const path& p);
|
||||||
|
|
||||||
} // namespace sys
|
} // namespace sys
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue