win32-dir 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -1,32 +1,32 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
-
5
- CLEAN.include('**/*.gem', '**/*.log')
6
-
7
- namespace 'gem' do
8
- desc "Create the win32-dir gem"
9
- task :build => [:clean] do
10
- Dir["*.gem"].each{ |f| File.delete(f) }
11
- spec = eval(IO.read('win32-dir.gemspec'))
12
- Gem::Builder.new(spec).build
13
- end
14
-
15
- desc "Install the win32-dir gem"
16
- task :install => [:build] do
17
- file = Dir["*.gem"].first
18
- sh "gem install #{file}"
19
- end
20
- end
21
-
22
- desc "Run the example program"
23
- task :example do
24
- sh "ruby -Ilib examples/dir_example.rb"
25
- end
26
-
27
- Rake::TestTask.new do |t|
28
- t.warning = true
29
- t.verbose = true
30
- end
31
-
32
- task :default => :test
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+
5
+ CLEAN.include('**/*.gem', '**/*.log')
6
+
7
+ namespace 'gem' do
8
+ desc "Create the win32-dir gem"
9
+ task :build => [:clean] do
10
+ Dir["*.gem"].each{ |f| File.delete(f) }
11
+ spec = eval(IO.read('win32-dir.gemspec'))
12
+ Gem::Builder.new(spec).build
13
+ end
14
+
15
+ desc "Install the win32-dir gem"
16
+ task :install => [:build] do
17
+ file = Dir["*.gem"].first
18
+ sh "gem install #{file}"
19
+ end
20
+ end
21
+
22
+ desc "Run the example program"
23
+ task :example do
24
+ sh "ruby -Ilib examples/dir_example.rb"
25
+ end
26
+
27
+ Rake::TestTask.new do |t|
28
+ t.warning = true
29
+ t.verbose = true
30
+ end
31
+
32
+ task :default => :test
@@ -1,18 +1,18 @@
1
- module Dir::Constants
2
- private
3
-
4
- FILE_DEVICE_FILE_SYSTEM = 0x00000009
5
- INVALID_HANDLE_VALUE = 0xFFFFFFFF
6
- INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF
7
- FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
8
- FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
9
- FILE_ATTRIBUTE_DIRECTORY = 0x00000010
10
- FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
11
- ERROR_ALREADY_EXISTS = 183
12
- METHOD_BUFFERED = 0
13
- OPEN_EXISTING = 3
14
- GENERIC_READ = 0x80000000
15
- GENERIC_WRITE = 0x40000000
16
- SHGFI_DISPLAYNAME = 0x000000200
17
- SHGFI_PIDL = 0x000000008
18
- end
1
+ module Dir::Constants
2
+ private
3
+
4
+ FILE_DEVICE_FILE_SYSTEM = 0x00000009
5
+ INVALID_HANDLE_VALUE = 0xFFFFFFFF
6
+ INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF
7
+ FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
8
+ FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
9
+ FILE_ATTRIBUTE_DIRECTORY = 0x00000010
10
+ FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
11
+ ERROR_ALREADY_EXISTS = 183
12
+ METHOD_BUFFERED = 0
13
+ OPEN_EXISTING = 3
14
+ GENERIC_READ = 0x80000000
15
+ GENERIC_WRITE = 0x40000000
16
+ SHGFI_DISPLAYNAME = 0x000000200
17
+ SHGFI_PIDL = 0x000000008
18
+ end
@@ -1,35 +1,35 @@
1
- # Necessary to force JRuby to use the gem, not its builtin version
2
- if RUBY_PLATFORM == 'java'
3
- require 'rubygems'
4
- gem 'ffi'
5
- end
6
-
7
- require 'ffi'
8
-
9
- module Dir::Functions
10
- extend FFI::Library
11
-
12
- ffi_lib :shell32
13
-
14
- attach_function :SHGetFolderPathW, [:ulong, :int, :ulong, :ulong, :buffer_out], :ulong
15
- attach_function :SHGetFolderLocation, [:ulong, :int, :ulong, :ulong, :pointer], :ulong
16
- attach_function :SHGetFileInfo, [:ulong, :ulong, :pointer, :uint, :uint], :ulong
17
-
18
- ffi_lib :shlwapi
19
-
20
- attach_function :PathIsDirectoryEmptyW, [:buffer_in], :bool
21
-
22
- ffi_lib :kernel32
23
-
24
- attach_function :CloseHandle, [:ulong], :bool
25
- attach_function :CreateDirectoryW, [:buffer_in, :pointer], :bool
26
- attach_function :CreateFileW, [:buffer_in, :ulong, :ulong, :pointer, :ulong, :ulong, :ulong], :ulong
27
- attach_function :DeviceIoControl, [:ulong, :ulong, :pointer, :ulong, :pointer, :ulong, :pointer, :pointer], :bool
28
- attach_function :GetCurrentDirectoryW, [:ulong, :buffer_out], :ulong
29
- attach_function :GetFileAttributesW, [:buffer_in], :ulong
30
- attach_function :GetLastError, [], :ulong
31
- attach_function :GetShortPathNameW, [:buffer_in, :buffer_out, :ulong], :ulong
32
- attach_function :GetLongPathNameW, [:buffer_in, :buffer_out, :ulong], :ulong
33
- attach_function :GetFullPathNameW, [:buffer_in, :ulong, :buffer_out, :pointer], :ulong
34
- attach_function :RemoveDirectoryW, [:buffer_in], :bool
35
- end
1
+ # Necessary to force JRuby to use the gem, not its builtin version
2
+ if RUBY_PLATFORM == 'java'
3
+ require 'rubygems'
4
+ gem 'ffi'
5
+ end
6
+
7
+ require 'ffi'
8
+
9
+ module Dir::Functions
10
+ extend FFI::Library
11
+
12
+ ffi_lib :shell32
13
+
14
+ attach_function :SHGetFolderPathW, [:ulong, :int, :ulong, :ulong, :buffer_out], :ulong
15
+ attach_function :SHGetFolderLocation, [:ulong, :int, :ulong, :ulong, :pointer], :ulong
16
+ attach_function :SHGetFileInfo, [:ulong, :ulong, :pointer, :uint, :uint], :ulong
17
+
18
+ ffi_lib :shlwapi
19
+
20
+ attach_function :PathIsDirectoryEmptyW, [:buffer_in], :bool
21
+
22
+ ffi_lib :kernel32
23
+
24
+ attach_function :CloseHandle, [:ulong], :bool
25
+ attach_function :CreateDirectoryW, [:buffer_in, :pointer], :bool
26
+ attach_function :CreateFileW, [:buffer_in, :ulong, :ulong, :pointer, :ulong, :ulong, :ulong], :ulong
27
+ attach_function :DeviceIoControl, [:ulong, :ulong, :pointer, :ulong, :pointer, :ulong, :pointer, :pointer], :bool
28
+ attach_function :GetCurrentDirectoryW, [:ulong, :buffer_out], :ulong
29
+ attach_function :GetFileAttributesW, [:buffer_in], :ulong
30
+ attach_function :GetLastError, [], :ulong
31
+ attach_function :GetShortPathNameW, [:buffer_in, :buffer_out, :ulong], :ulong
32
+ attach_function :GetLongPathNameW, [:buffer_in, :buffer_out, :ulong], :ulong
33
+ attach_function :GetFullPathNameW, [:buffer_in, :ulong, :buffer_out, :pointer], :ulong
34
+ attach_function :RemoveDirectoryW, [:buffer_in], :bool
35
+ end
@@ -1,29 +1,29 @@
1
- require 'ffi'
2
-
3
- module Dir::Structs
4
- extend FFI::Library
5
-
6
- class SHFILEINFO < FFI::Struct
7
- layout(
8
- :hIcon, :ulong,
9
- :iIcon, :int,
10
- :dwAttributes, :ulong,
11
- :szDisplayName, [:char, 256],
12
- :szTypeName, [:char, 80]
13
- )
14
- end
15
-
16
- # I fudge a bit, assuming a MountPointReparseBuffer
17
- class REPARSE_JDATA_BUFFER < FFI::Struct
18
- layout(
19
- :ReparseTag, :ulong,
20
- :ReparseDataLength, :ushort,
21
- :Reserved, :ushort,
22
- :SubstituteNameOffset, :ushort,
23
- :SubstituteNameLength, :ushort,
24
- :PrintNameOffset, :ushort,
25
- :PrintNameLength, :ushort,
26
- :PathBuffer, [:char, 1024]
27
- )
28
- end
29
- end
1
+ require 'ffi'
2
+
3
+ module Dir::Structs
4
+ extend FFI::Library
5
+
6
+ class SHFILEINFO < FFI::Struct
7
+ layout(
8
+ :hIcon, :ulong,
9
+ :iIcon, :int,
10
+ :dwAttributes, :ulong,
11
+ :szDisplayName, [:char, 256],
12
+ :szTypeName, [:char, 80]
13
+ )
14
+ end
15
+
16
+ # I fudge a bit, assuming a MountPointReparseBuffer
17
+ class REPARSE_JDATA_BUFFER < FFI::Struct
18
+ layout(
19
+ :ReparseTag, :ulong,
20
+ :ReparseDataLength, :ushort,
21
+ :Reserved, :ushort,
22
+ :SubstituteNameOffset, :ushort,
23
+ :SubstituteNameLength, :ushort,
24
+ :PrintNameOffset, :ushort,
25
+ :PrintNameLength, :ushort,
26
+ :PathBuffer, [:char, 1024]
27
+ )
28
+ end
29
+ end