mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
Set the long path bit only in ruby_setup
`ruby_setup` runs for `ruby.exe` too, so calling this from `rb_w32_sysinit` as well was redundant. Nothing between the two touches a path long enough to care, including the wildcard expansion in `w32_cmdvector`, which does not expand a result over 260 characters either way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b81e0d4888
commit
771de37f8b
1 file changed
+2
-8
Notes:
git
2026-08-19 07:31:44 +00:00
+2
-8
@@ -853,9 +853,8 @@ static int w32_cmdvector(const WCHAR *, char ***, UINT, rb_encoding *);
|
||||
* runtime <https://go.dev/src/runtime/os_windows.go>, whose maintainers have
|
||||
* proposed to drop it <https://github.com/golang/go/issues/66560>.
|
||||
*
|
||||
* Called from rb_w32_sysinit, which runs before the VM exists, and from
|
||||
* ruby_setup, so that a program which embeds libruby without calling
|
||||
* ruby_sysinit gets it as well. */
|
||||
* Called from ruby_setup, not from rb_w32_sysinit, which a program that
|
||||
* embeds libruby is not expected to call. */
|
||||
void
|
||||
rb_w32_init_long_paths(void)
|
||||
{
|
||||
@@ -863,15 +862,11 @@ rb_w32_init_long_paths(void)
|
||||
enum {peb_bit_field_offset = 3, is_long_path_aware_process = 0x80};
|
||||
typedef long (WINAPI version_func)(OSVERSIONINFOW *);
|
||||
typedef void *(WINAPI peb_func)(void);
|
||||
static int done = 0;
|
||||
version_func *pRtlGetVersion;
|
||||
peb_func *pRtlGetCurrentPeb;
|
||||
OSVERSIONINFOW osvi;
|
||||
BYTE *bit_field;
|
||||
|
||||
if (done) return;
|
||||
done = 1;
|
||||
|
||||
pRtlGetVersion = (version_func *)get_proc_address("ntdll.dll", "RtlGetVersion", NULL);
|
||||
if (!pRtlGetVersion) return;
|
||||
memset(&osvi, 0, sizeof(osvi));
|
||||
@@ -900,7 +895,6 @@ rb_w32_sysinit(int *argc, char ***argv)
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);
|
||||
|
||||
get_version();
|
||||
rb_w32_init_long_paths();
|
||||
|
||||
//
|
||||
// subvert cmd.exe's feeble attempt at command line parsing
|
||||
|
||||
Reference in new issue
Block a user