Skip to content
Snippets Groups Projects
Commit 89eb8c6e authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Linux build fix

parent fb085372
No related branches found
No related tags found
No related merge requests found
...@@ -454,6 +454,37 @@ bool LLFile::copy(const std::string& from, const std::string& to) ...@@ -454,6 +454,37 @@ bool LLFile::copy(const std::string& from, const std::string& to)
return copied; return copied;
} }
bool LLFile::copy(const boost::filesystem::path& from, const boost::filesystem::path& to)
{
bool copied = false;
LLFILE* in = LLFile::fopen(from, TEXT("rb")); /* Flawfinder: ignore */
if (in)
{
LLFILE* out = LLFile::fopen(to, TEXT("wb")); /* Flawfinder: ignore */
if (out)
{
char buf[16384]; /* Flawfinder: ignore */
size_t readbytes;
bool write_ok = true;
while (write_ok && (readbytes = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */
{
if (fwrite(buf, 1, readbytes, out) != readbytes)
{
LL_WARNS("LLFile") << "Short write" << LL_ENDL;
write_ok = false;
}
}
if (write_ok)
{
copied = true;
}
fclose(out);
}
fclose(in);
}
return copied;
}
int LLFile::stat(const std::string& filename, llstat* filestatus) int LLFile::stat(const std::string& filename, llstat* filestatus)
{ {
#if LL_WINDOWS #if LL_WINDOWS
......
...@@ -64,6 +64,7 @@ typedef struct stat llstat; ...@@ -64,6 +64,7 @@ typedef struct stat llstat;
#define MODE_T const wchar_t* #define MODE_T const wchar_t*
#else #else
#define MODE_T const char* #define MODE_T const char*
#define TEXT(quote)
#endif #endif
class LL_COMMON_API LLFile class LL_COMMON_API LLFile
...@@ -87,6 +88,7 @@ class LL_COMMON_API LLFile ...@@ -87,6 +88,7 @@ class LL_COMMON_API LLFile
static int rename(const std::string& filename,const std::string& newname, int supress_error = 0); static int rename(const std::string& filename,const std::string& newname, int supress_error = 0);
static int rename(const boost::filesystem::path& filename, const boost::filesystem::path& newname, int supress_error = 0); static int rename(const boost::filesystem::path& filename, const boost::filesystem::path& newname, int supress_error = 0);
static bool copy(const std::string& from, const std::string& to); static bool copy(const std::string& from, const std::string& to);
static bool copy(const boost::filesystem::path& from, const boost::filesystem::path& to);
static int stat(const std::string& filename, llstat* file_status); static int stat(const std::string& filename, llstat* file_status);
static int stat(const boost::filesystem::path& filename, llstat* file_status); static int stat(const boost::filesystem::path& filename, llstat* file_status);
......
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#ifndef TEXT
#define TEXT(quote)
#endif
LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode) LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode)
: mFileID(file_id), : mFileID(file_id),
mFileType(file_type), mFileType(file_type),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment