Skip to content
This repository
Browse code

Merge pull request #2984 from whaupt/xbmc/ofc/master

[WebServer] Simplify file existence check
  • Loading branch information...
commit ecf024b02489a13f7478b5d58868e38c535f1e3a 2 parents d3a22bb + 1d82f05
Trent Nelson authored July 21, 2013

Showing 1 changed file with 3 additions and 12 deletions. Show diff stats Hide diff stats

  1. 15  xbmc/network/WebServer.cpp
15  xbmc/network/WebServer.cpp
@@ -838,17 +838,7 @@ void CWebServer::SetCredentials(const string &username, const string &password)
838 838
 
839 839
 bool CWebServer::PrepareDownload(const char *path, CVariant &details, std::string &protocol)
840 840
 {
841  
-  bool exists = false;
842  
-  CFile *file = new CFile();
843  
-  if (file->Open(path))
844  
-  {
845  
-    exists = true;
846  
-    file->Close();
847  
-  }
848  
-
849  
-  delete file;
850  
-
851  
-  if (exists)
  841
+  if (CFile::Exists(path))
852 842
   {
853 843
     protocol = "http";
854 844
     string url;
@@ -861,9 +851,10 @@ bool CWebServer::PrepareDownload(const char *path, CVariant &details, std::strin
861 851
     CURL::Encode(strPath);
862 852
     url += strPath;
863 853
     details["path"] = url;
  854
+    return true;
864 855
   }
865 856
 
866  
-  return exists;
  857
+  return false;
867 858
 }
868 859
 
869 860
 bool CWebServer::Download(const char *path, CVariant &result)

0 notes on commit ecf024b

Please sign in to comment.
Something went wrong with that request. Please try again.