Skip to content

Commit

Permalink
[davfile] use PROPFIND for Stat() and Exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
mkortstiege committed Apr 13, 2015
1 parent cc252ce commit 91ffcad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions xbmc/filesystem/DAVFile.cpp
Expand Up @@ -130,6 +130,21 @@ bool CDAVFile::Delete(const CURL& url)
return true;
}

bool CDAVFile::Exists(const CURL& url)
{
return Stat(url,NULL) == 0;
}

int CDAVFile::Stat(const CURL& url, struct __stat64* buffer)
{
CCurlFile dav;
std::string strRequest = "PROPFIND";
dav.SetCustomRequest(strRequest);
dav.SetRequestHeader("depth", 0);

return dav.Stat(url, buffer);
}

bool CDAVFile::Rename(const CURL& url, const CURL& urlnew)
{
if (m_opened)
Expand Down
6 changes: 4 additions & 2 deletions xbmc/filesystem/DAVFile.h
Expand Up @@ -31,13 +31,15 @@ namespace XFILE
virtual ~CDAVFile(void);

virtual bool Execute(const CURL& url);

virtual bool Delete(const CURL& url);
virtual bool Rename(const CURL& url, const CURL& urlnew);

virtual bool Exists(const CURL& url);
virtual int Stat(const CURL& url, struct __stat64* buffer);

virtual int GetLastResponseCode() { return lastResponseCode; }

private:
int lastResponseCode;
};
}
}

0 comments on commit 91ffcad

Please sign in to comment.