Project

General

Profile

Actions

Bug #590

closed

tmpdir on mswin32

Added by ko1 (Koichi Sasada) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-dev:36493]

Description

=begin
 ささだです.

 tmpdir 初期化時,Win32API の SHGetFolderPath でパスを取ってくる
と,末尾に nul が入るため,expand_path が失敗するようです(rstrip し
ても nul は取れない).とりあえず chop してしまったんですが,どうす
るのが良いでしょうか.

Index: lib/tmpdir.rb

--- lib/tmpdir.rb (リビジョン 19506)
+++ lib/tmpdir.rb (作業コピー)
@@ -18,7 +16,7 @@
begin
getdir = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
raise RuntimeError if getdir.call(0, CSIDL_LOCAL_APPDATA, 0,
0, windir) != 0

  •  windir = File.expand_path(windir.rstrip)
    
  •  windir = File.expand_path(windir.rstrip.chop)
    
    rescue RuntimeError
    begin
    getdir = Win32API.new('kernel32',
    'GetSystemWindowsDirectory', 'PL', 'L')

--
// SASADA Koichi at atdot dot net
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0