Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
564a7acb
"...xdg-integration.git" did not exist on "56fd090f492967306794f57a3cea08e9e86e4e33"
Commit
564a7acb
authored
3 years ago
by
Ansariel
Browse files
Options
Downloads
Patches
Plain Diff
Change all remaining boost::filesystem methods to their non-throwing overloads
parent
d0f2a2c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llfilesystem/lldiskcache.cpp
+24
-11
24 additions, 11 deletions
indra/llfilesystem/lldiskcache.cpp
with
24 additions
and
11 deletions
indra/llfilesystem/lldiskcache.cpp
+
24
−
11
View file @
564a7acb
...
@@ -87,6 +87,7 @@ void LLDiskCache::purge()
...
@@ -87,6 +87,7 @@ void LLDiskCache::purge()
LL_INFOS
()
<<
"Total dir size before purge is "
<<
dirFileSize
(
mCacheDir
)
<<
LL_ENDL
;
LL_INFOS
()
<<
"Total dir size before purge is "
<<
dirFileSize
(
mCacheDir
)
<<
LL_ENDL
;
}
}
boost
::
system
::
error_code
ec
;
auto
start_time
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
start_time
=
std
::
chrono
::
high_resolution_clock
::
now
();
typedef
std
::
pair
<
std
::
time_t
,
std
::
pair
<
uintmax_t
,
std
::
string
>>
file_info_t
;
typedef
std
::
pair
<
std
::
time_t
,
std
::
pair
<
uintmax_t
,
std
::
string
>>
file_info_t
;
...
@@ -97,17 +98,25 @@ void LLDiskCache::purge()
...
@@ -97,17 +98,25 @@ void LLDiskCache::purge()
#else
#else
std
::
string
cache_path
(
mCacheDir
);
std
::
string
cache_path
(
mCacheDir
);
#endif
#endif
if
(
boost
::
filesystem
::
is_directory
(
cache_path
))
if
(
boost
::
filesystem
::
is_directory
(
cache_path
,
ec
)
&&
!
ec
.
failed
(
))
{
{
for
(
auto
&
entry
:
boost
::
make_iterator_range
(
boost
::
filesystem
::
directory_iterator
(
cache_path
),
{}))
for
(
auto
&
entry
:
boost
::
make_iterator_range
(
boost
::
filesystem
::
directory_iterator
(
cache_path
),
{}))
{
{
if
(
boost
::
filesystem
::
is_regular_file
(
entry
))
if
(
boost
::
filesystem
::
is_regular_file
(
entry
,
ec
)
&&
!
ec
.
failed
(
))
{
{
if
(
entry
.
path
().
string
().
find
(
mCacheFilenamePrefix
)
!=
std
::
string
::
npos
)
if
(
entry
.
path
().
string
().
find
(
mCacheFilenamePrefix
)
!=
std
::
string
::
npos
)
{
{
uintmax_t
file_size
=
boost
::
filesystem
::
file_size
(
entry
);
uintmax_t
file_size
=
boost
::
filesystem
::
file_size
(
entry
,
ec
);
if
(
ec
.
failed
())
{
continue
;
}
const
std
::
string
file_path
=
entry
.
path
().
string
();
const
std
::
string
file_path
=
entry
.
path
().
string
();
const
std
::
time_t
file_time
=
boost
::
filesystem
::
last_write_time
(
entry
);
const
std
::
time_t
file_time
=
boost
::
filesystem
::
last_write_time
(
entry
,
ec
);
if
(
ec
.
failed
())
{
continue
;
}
file_info
.
push_back
(
file_info_t
(
file_time
,
{
file_size
,
file_path
}));
file_info
.
push_back
(
file_info_t
(
file_time
,
{
file_size
,
file_path
}));
}
}
...
@@ -131,7 +140,6 @@ void LLDiskCache::purge()
...
@@ -131,7 +140,6 @@ void LLDiskCache::purge()
if
(
file_size_total
>
mMaxSizeBytes
)
if
(
file_size_total
>
mMaxSizeBytes
)
{
{
action
=
"DELETE:"
;
action
=
"DELETE:"
;
boost
::
system
::
error_code
ec
;
boost
::
filesystem
::
remove
(
entry
.
second
.
second
,
ec
);
boost
::
filesystem
::
remove
(
entry
.
second
.
second
,
ec
);
if
(
ec
.
failed
())
if
(
ec
.
failed
())
{
{
...
@@ -321,20 +329,20 @@ void LLDiskCache::clearCache()
...
@@ -321,20 +329,20 @@ void LLDiskCache::clearCache()
* the component files but it's called infrequently so it's
* the component files but it's called infrequently so it's
* likely just fine
* likely just fine
*/
*/
boost
::
system
::
error_code
ec
;
#if LL_WINDOWS
#if LL_WINDOWS
std
::
wstring
cache_path
(
utf8str_to_utf16str
(
mCacheDir
));
std
::
wstring
cache_path
(
utf8str_to_utf16str
(
mCacheDir
));
#else
#else
std
::
string
cache_path
(
mCacheDir
);
std
::
string
cache_path
(
mCacheDir
);
#endif
#endif
if
(
boost
::
filesystem
::
is_directory
(
cache_path
))
if
(
boost
::
filesystem
::
is_directory
(
cache_path
,
ec
)
&&
!
ec
.
failed
(
))
{
{
for
(
auto
&
entry
:
boost
::
make_iterator_range
(
boost
::
filesystem
::
directory_iterator
(
cache_path
),
{}))
for
(
auto
&
entry
:
boost
::
make_iterator_range
(
boost
::
filesystem
::
directory_iterator
(
cache_path
),
{}))
{
{
if
(
boost
::
filesystem
::
is_regular_file
(
entry
))
if
(
boost
::
filesystem
::
is_regular_file
(
entry
,
ec
)
&&
!
ec
.
failed
(
))
{
{
if
(
entry
.
path
().
string
().
find
(
mCacheFilenamePrefix
)
!=
std
::
string
::
npos
)
if
(
entry
.
path
().
string
().
find
(
mCacheFilenamePrefix
)
!=
std
::
string
::
npos
)
{
{
boost
::
system
::
error_code
ec
;
boost
::
filesystem
::
remove
(
entry
,
ec
);
boost
::
filesystem
::
remove
(
entry
,
ec
);
if
(
ec
.
failed
())
if
(
ec
.
failed
())
{
{
...
@@ -359,20 +367,25 @@ uintmax_t LLDiskCache::dirFileSize(const std::string dir)
...
@@ -359,20 +367,25 @@ uintmax_t LLDiskCache::dirFileSize(const std::string dir)
* so if performance is ever an issue, optimizing this or removing it altogether,
* so if performance is ever an issue, optimizing this or removing it altogether,
* is an easy win.
* is an easy win.
*/
*/
boost
::
system
::
error_code
ec
;
#if LL_WINDOWS
#if LL_WINDOWS
std
::
wstring
dir_path
(
utf8str_to_utf16str
(
dir
));
std
::
wstring
dir_path
(
utf8str_to_utf16str
(
dir
));
#else
#else
std
::
string
dir_path
(
dir
);
std
::
string
dir_path
(
dir
);
#endif
#endif
if
(
boost
::
filesystem
::
is_directory
(
dir_path
))
if
(
boost
::
filesystem
::
is_directory
(
dir_path
,
ec
)
&&
!
ec
.
failed
(
))
{
{
for
(
auto
&
entry
:
boost
::
make_iterator_range
(
boost
::
filesystem
::
directory_iterator
(
dir_path
),
{}))
for
(
auto
&
entry
:
boost
::
make_iterator_range
(
boost
::
filesystem
::
directory_iterator
(
dir_path
),
{}))
{
{
if
(
boost
::
filesystem
::
is_regular_file
(
entry
))
if
(
boost
::
filesystem
::
is_regular_file
(
entry
,
ec
)
&&
!
ec
.
failed
(
))
{
{
if
(
entry
.
path
().
string
().
find
(
mCacheFilenamePrefix
)
!=
std
::
string
::
npos
)
if
(
entry
.
path
().
string
().
find
(
mCacheFilenamePrefix
)
!=
std
::
string
::
npos
)
{
{
total_file_size
+=
boost
::
filesystem
::
file_size
(
entry
);
uintmax_t
file_size
=
boost
::
filesystem
::
file_size
(
entry
,
ec
);
if
(
!
ec
.
failed
())
{
total_file_size
+=
file_size
;
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment