mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
a1bc268963
Summary: std::string_view has noexcept accessors and folly::Range doesn't, so this allows us to make Path and PathPiece noexcept. Reviewed By: kmancini Differential Revision: D41145426 fbshipit-source-id: 046f6f6a532d8d0da8508ccf7896c914e19a25ec
28 lines
778 B
C++
28 lines
778 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include "eden/fs/utils/NfsSocket.h"
|
|
|
|
#include <folly/Exception.h>
|
|
|
|
namespace facebook::eden {
|
|
|
|
folly::SocketAddress makeNfsSocket(std::optional<AbsolutePath> unixSocketPath) {
|
|
if (folly::kIsApple && unixSocketPath.has_value()) {
|
|
int rc = unlink(unixSocketPath->c_str());
|
|
if (rc != 0 && errno != ENOENT) {
|
|
folly::throwSystemError(
|
|
fmt::format("unable to remove socket file {}", *unixSocketPath));
|
|
}
|
|
return folly::SocketAddress::makeFromPath(unixSocketPath->view());
|
|
} else {
|
|
return folly::SocketAddress("127.0.0.1", 0);
|
|
}
|
|
}
|
|
|
|
} // namespace facebook::eden
|