@@ -159,7 +159,8 @@ class S3FileSystem : public FileSystem {
159159 const std::string& path, const char * contents,
160160 const size_t content_len) override ;
161161 Status MakeDirectory (const std::string& dir, const bool recursive) override ;
162- Status MakeTemporaryDirectory (std::string dir_path, std::string* temp_dir) override ;
162+ Status MakeTemporaryDirectory (
163+ std::string dir_path, std::string* temp_dir) override ;
163164 Status DeletePath (const std::string& path) override ;
164165
165166 private:
@@ -653,19 +654,15 @@ S3FileSystem::LocalizePath(
653654 }
654655
655656 // Create a local directory for AWS model store.
656- // If ENV variable are not set, creates a temporary directory
657+ // If ENV variable are not set, creates a temporary directory
657658 // under `/tmp` with the format: "folderXXXXXX".
658659 // Otherwise, will create a folder under specified directory with the same
659660 // format.
660- const char * env_mount_dir = std::getenv (" TRITON_AWS_MOUNT_DIRECTORY" );
661+ std::string env_mount_dir =
662+ GetEnvironmentVariableOrDefault (" TRITON_AWS_MOUNT_DIRECTORY" , " /tmp" );
661663 std::string tmp_folder;
662- if (env_mount_dir == nullptr ) {
663- RETURN_IF_ERROR (
664- triton::core::MakeTemporaryDirectory (FileSystemType::LOCAL, &tmp_folder));
665- } else {
666- RETURN_IF_ERROR (
667- triton::core::MakeTemporaryDirectory (FileSystemType::LOCAL, std::string (env_mount_dir), &tmp_folder));
668- }
664+ RETURN_IF_ERROR (triton::core::MakeTemporaryDirectory (
665+ FileSystemType::LOCAL, std::string (env_mount_dir), &tmp_folder));
669666
670667 // Specify contents to be downloaded
671668 std::set<std::string> contents;
@@ -784,7 +781,8 @@ S3FileSystem::MakeDirectory(const std::string& dir, const bool recursive)
784781}
785782
786783Status
787- S3FileSystem::MakeTemporaryDirectory (std::string dir_path, std::string* temp_dir)
784+ S3FileSystem::MakeTemporaryDirectory (
785+ std::string dir_path, std::string* temp_dir)
788786{
789787 return Status (
790788 Status::Code::UNSUPPORTED,
0 commit comments