Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Nov 17, 2023
1 parent 60890c6 commit 9dbc1c9
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions cpp/src/arrow/filesystem/azurefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -704,23 +704,15 @@ class AzureFileSystem::Impl {
return Status::OK();
}

std::string current_path;
for (const auto& part : path.path_to_file_parts) {
if (!current_path.empty()) {
current_path += internal::kSep;
}
current_path += part;
auto directory_client =
datalake_service_client_->GetFileSystemClient(path.container)
.GetDirectoryClient(current_path);
try {
directory_client.CreateIfNotExists();
} catch (const Azure::Storage::StorageException& exception) {
return internal::ExceptionToStatus(
"Failed to create a directory: " + current_path + " (" +
directory_client.GetUrl() + ")",
exception);
}
auto directory_client = datalake_service_client_->GetFileSystemClient(path.container)
.GetDirectoryClient(path.path_to_file);
try {
directory_client.CreateIfNotExists();
} catch (const Azure::Storage::StorageException& exception) {
return internal::ExceptionToStatus(
"Failed to create a directory: " + path.path_to_file + " (" +
directory_client.GetUrl() + ")",
exception);
}

return Status::OK();
Expand Down

0 comments on commit 9dbc1c9

Please sign in to comment.