Sha256: 077c86f5933a21c750cc67ae4abd2b0a92bd53faa1c1b195348e70124d4af819

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

# -*- coding: utf-8 -*-
#
# Copyright 2013 whiteleaf. All rights reserved.
#

module WinAPI
  begin
    require "fiddle/import"
    extend Fiddle::Importer
  rescue LoadError
    # Fiddle がない環境用(http://www.artonx.org/data/asr/ の1.9.3とか)
    require "dl/import"
    extend DL::Importer
  end

  begin
    dlload "msvcrt", "kernel32"
  rescue DL::DLError
    dlload "crtdll", "kernel32"
  end
  extern "long GetLogicalDrives()"
  extern "unsigned long SetConsoleTextAttribute(unsigned long, unsigned long)"
  extern "unsigned long GetConsoleScreenBufferInfo(unsigned long, void*)"
  extern "unsigned long GetStdHandle(unsigned long)"
  extern "long GetLastError()"
  extern "unsigned long _getch()"
end

require "tmpdir"

# テンポラリディレクトリのパスにASCII以外が含まれていると、systemu が
# エラーになる問題に対処するモンキーパッチ。
# テンポラリディレクトリをユーザーディレクトリからシステムに切り替える
if Dir.tmpdir !~ /\A[ -~]+\z/
  def Dir.tmpdir
    File.expand_path(File.join(ENV["SystemRoot"], "Temp"))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
narou-2.8.1 lib/extensions/windows.rb
narou-2.8.0 lib/extensions/windows.rb
narou-2.7.2 lib/extensions/windows.rb
narou-2.7.1 lib/extensions/windows.rb