fix(cleanup): ensure FLAGS_log_dir ends with '/' (#972)
This commit is contained in:
parent
b58718f37c
commit
da9753409b
1
AUTHORS
1
AUTHORS
@ -16,6 +16,7 @@ Brian Silverman <bsilver16384@gmail.com>
|
||||
Dmitriy Arbitman <d.arbitman@gmail.com>
|
||||
Google Inc.
|
||||
Guillaume Dumont <dumont.guillaume@gmail.com>
|
||||
LingBin <lingbinlb@gmail.com>
|
||||
Marco Wang <m.aesophor@gmail.com>
|
||||
Michael Tanner <michael@tannertaxpro.com>
|
||||
MiniLight <MiniLightAR@Gmail.com>
|
||||
|
||||
@ -36,6 +36,7 @@ Håkan L. S. Younes <hyounes@google.com>
|
||||
Ivan Penkov <ivanpe@google.com>
|
||||
Jacob Trimble <modmaker@google.com>
|
||||
Jim Ray <jimray@google.com>
|
||||
LingBin <lingbinlb@gmail.com>
|
||||
Marco Wang <m.aesophor@gmail.com>
|
||||
Michael Darr <mdarr@matician.com>
|
||||
Michael Tanner <michael@tannertaxpro.com>
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <iomanip>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@ -2397,8 +2398,13 @@ const vector<string>& GetLoggingDirectories() {
|
||||
logging_directories_list = new vector<string>;
|
||||
|
||||
if ( !FLAGS_log_dir.empty() ) {
|
||||
// A dir was specified, we should use it
|
||||
logging_directories_list->push_back(FLAGS_log_dir);
|
||||
// Ensure the specified path ends with a directory delimiter.
|
||||
if (std::find(std::begin(possible_dir_delim), std::end(possible_dir_delim),
|
||||
FLAGS_log_dir.back()) == std::end(possible_dir_delim)) {
|
||||
logging_directories_list->push_back(FLAGS_log_dir + "/");
|
||||
} else {
|
||||
logging_directories_list->push_back(FLAGS_log_dir);
|
||||
}
|
||||
} else {
|
||||
GetTempDirectories(logging_directories_list);
|
||||
#ifdef GLOG_OS_WINDOWS
|
||||
|
||||
Loading…
Reference in New Issue
Block a user