Skip to content

Commit e65a0fd

Browse files
committed
Revert "Create DOS device only when needed"
This reverts commit c774a50.
1 parent ddbd0e1 commit e65a0fd

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

elisp/private/tools/emacs.cc

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,16 @@ static absl::StatusOr<int> RunEmacs(
5454
if (kWindows && release) {
5555
const absl::StatusOr<FileName> root = runfiles->Resolve(install);
5656
if (!root.ok()) return root.status();
57-
// The longest filename in the Emacs release archive has 140 characters.
58-
// Round up to 150 for some buffer and the directory separator.
59-
constexpr std::size_t kMaxEntry = 150;
60-
const std::size_t max_filename = MaxFilename();
61-
CHECK_GT(max_filename, kMaxEntry);
62-
const std::size_t max_root = max_filename - kMaxEntry;
63-
if (root->string().length() > max_root) {
64-
// The filenames in the released Emacs archive are too long. Create a
65-
// drive letter to shorten them.
66-
absl::StatusOr<DosDevice> device = DosDevice::Create(*root);
67-
if (!device.ok()) return device.status();
68-
absl::StatusOr<FileName> program = FileName::FromString(
69-
device->name() + RULES_ELISP_NATIVE_LITERAL("\\bin\\emacs.exe"));
70-
if (!program.ok()) return program.status();
71-
emacs = *std::move(program);
72-
dos_device = *std::move(device);
73-
}
74-
}
75-
if (!dos_device.has_value()) {
57+
// The filenames in the released Emacs archive are too long. Create a
58+
// drive letter to shorten them.
59+
absl::StatusOr<DosDevice> device = DosDevice::Create(*root);
60+
if (!device.ok()) return device.status();
61+
absl::StatusOr<FileName> program = FileName::FromString(
62+
device->name() + RULES_ELISP_NATIVE_LITERAL("\\bin\\emacs.exe"));
63+
if (!program.ok()) return program.status();
64+
emacs = *std::move(program);
65+
dos_device = *std::move(device);
66+
} else {
7667
absl::StatusOr<FileName> binary = runfiles->Resolve(
7768
absl::StrCat(install, release ? "/bin/emacs.exe" : "/emacs.exe"));
7869
if (!binary.ok()) return binary.status();

elisp/private/tools/system.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,6 @@ absl::StatusOr<FileName> FileName::Join(const NativeStringView descendant) const
186186
return this->Join(*name);
187187
}
188188

189-
static constexpr std::size_t kMaxFilename{
190-
#ifdef _WIN32
191-
MAX_PATH
192-
#else
193-
PATH_MAX
194-
#endif
195-
};
196-
197-
std::size_t MaxFilename() { return kMaxFilename; }
198-
199189
absl::Status MakeErrorStatus(const std::error_code& code,
200190
const std::string_view function,
201191
const std::string_view args) {

elisp/private/tools/system.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ class FileName final {
132132
NativeString string_;
133133
};
134134

135-
std::size_t MaxFilename();
136-
137135
absl::Status MakeErrorStatus(const std::error_code& code,
138136
std::string_view function, std::string_view args);
139137

0 commit comments

Comments
 (0)