Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
df90cdb
Add a new static function LLFile::size() to determine the size of a f…
fmartian Oct 25, 2025
004f508
Clarify some documentation and add an LLFile:read() and LLFile::write…
fmartian Oct 26, 2025
28dfedb
Merge branch 'develop' into LLAPRFile-cleanup
fmartian Oct 27, 2025
852b865
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Nov 6, 2025
3afe3dc
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Nov 11, 2025
4f00970
Refactoring of LLFile class to support additional methods
fmartian Nov 12, 2025
a5fab36
Add LLFile unit tests
fmartian Nov 12, 2025
0f8f219
Merge remote-tracking branch 'refs/remotes/origin/LLAPRFile-cleanup'
fmartian Nov 14, 2025
e024b87
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Nov 15, 2025
cfad6f3
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Nov 18, 2025
c3f4915
- Improve documentation of LLFile functions and methods
fmartian Nov 28, 2025
78be61e
Merge branch 'LLAPRFile-cleanup' of https://github.com/fmartian/secon…
fmartian Nov 28, 2025
ec1af1d
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Nov 28, 2025
b7a977f
Merge branch 'LLAPRFile-cleanup' of https://github.com/fmartian/secon…
fmartian Nov 28, 2025
428f6c3
The returned vector should only contain filenames, not the entire paths
fmartian Nov 29, 2025
453a736
Fix several typos and comments
fmartian Nov 29, 2025
8e258f7
Remove commented out old function calls
fmartian Nov 30, 2025
41b1e04
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Dec 1, 2025
5ab0189
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Dec 1, 2025
07c7231
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Dec 1, 2025
b3e1d31
Merge branch 'secondlife:develop' into LLAPRFile-cleanup
fmartian Dec 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 0 additions & 118 deletions indra/llcommon/llapr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,124 +628,6 @@ S32 LLAPRFile::writeEx(const std::string& filename, const void *buf, S32 offset,
return (S32)bytes_written;
}

//static
bool LLAPRFile::remove(const std::string& filename, LLVolatileAPRPool* pool)
{
apr_status_t s;

LLAPRFilePoolScope scope(pool);
s = apr_file_remove(filename.c_str(), scope.getVolatileAPRPool());

if (s != APR_SUCCESS)
{
ll_apr_warn_status(s);
LL_WARNS("APR") << " Attempting to remove filename: " << filename << LL_ENDL;
return false;
}
return true;
}

//static
bool LLAPRFile::rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool)
{
apr_status_t s;

LLAPRFilePoolScope scope(pool);
s = apr_file_rename(filename.c_str(), newname.c_str(), scope.getVolatileAPRPool());

if (s != APR_SUCCESS)
{
ll_apr_warn_status(s);
LL_WARNS("APR") << " Attempting to rename filename: " << filename << LL_ENDL;
return false;
}
return true;
}

//static
bool LLAPRFile::isExist(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags)
{
apr_file_t* apr_file;
apr_status_t s;

LLAPRFilePoolScope scope(pool);
s = apr_file_open(&apr_file, filename.c_str(), flags, APR_OS_DEFAULT, scope.getVolatileAPRPool());

if (s != APR_SUCCESS || !apr_file)
{
return false;
}
else
{
apr_file_close(apr_file) ;
return true;
}
}

//static
S32 LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool)
{
apr_file_t* apr_file;
apr_finfo_t info;
apr_status_t s;

LLAPRFilePoolScope scope(pool);
s = apr_file_open(&apr_file, filename.c_str(), APR_READ, APR_OS_DEFAULT, scope.getVolatileAPRPool());

if (s != APR_SUCCESS || !apr_file)
{
return 0;
}
else
{
apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file);

apr_file_close(apr_file) ;

if (s == APR_SUCCESS)
{
return (S32)info.size;
}
else
{
return 0;
}
}
}

//static
bool LLAPRFile::makeDir(const std::string& dirname, LLVolatileAPRPool* pool)
{
apr_status_t s;

LLAPRFilePoolScope scope(pool);
s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, scope.getVolatileAPRPool());

if (s != APR_SUCCESS)
{
ll_apr_warn_status(s);
LL_WARNS("APR") << " Attempting to make directory: " << dirname << LL_ENDL;
return false;
}
return true;
}

//static
bool LLAPRFile::removeDir(const std::string& dirname, LLVolatileAPRPool* pool)
{
apr_status_t s;

LLAPRFilePoolScope scope(pool);
s = apr_file_remove(dirname.c_str(), scope.getVolatileAPRPool());

if (s != APR_SUCCESS)
{
ll_apr_warn_status(s);
LL_WARNS("APR") << " Attempting to remove directory: " << dirname << LL_ENDL;
return false;
}
return true;
}
//
//end of static components of LLAPRFile
//*******************************************************************************************************************************
Expand Down
9 changes: 0 additions & 9 deletions indra/llcommon/llapr.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,10 @@ class LL_COMMON_API LLAPRFile
static apr_status_t close(apr_file_t* file) ;
static S32 seek(apr_file_t* file, apr_seek_where_t where, S32 offset);
public:
// returns false if failure:
static bool remove(const std::string& filename, LLVolatileAPRPool* pool = NULL);
static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = NULL);
static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = NULL, apr_int32_t flags = APR_READ);
static S32 size(const std::string& filename, LLVolatileAPRPool* pool = NULL);
static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL);
static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL);

// Returns bytes read/written, 0 if read/write fails:
static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
static S32 writeEx(const std::string& filename, const void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append
//*******************************************************************************************************************************
};


#endif // LL_LLAPR_H
10 changes: 3 additions & 7 deletions indra/llcommon/llerror.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,9 @@ namespace

std::string file = user_dir + "/logcontrol-dev.xml";

llstat stat_info;
if (LLFile::stat(file, &stat_info)) {
// NB: stat returns non-zero if it can't read the file, for example
// if it doesn't exist. LLFile has no better abstraction for
// testing for file existence.

file = app_dir + "/logcontrol.xml";
if (!LLFile::isfile(file))
{
file = app_dir + "/logcontrol.xml";
}
return * new LogControlFile(file);
// NB: This instance is never freed
Expand Down
Loading