win32-symlink 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cff5a6b053e50f47c45bdde6a29ba72088182522
4
- data.tar.gz: 88a4b8561aba22278fdfedfd94a3938cdbcf24ee
3
+ metadata.gz: 760f88f87cc420c1e2470fe822e2357ca9990848
4
+ data.tar.gz: 6fe503def472e253fc22136ce6ae0b2931a7f6ba
5
5
  SHA512:
6
- metadata.gz: 2dc15b209921a53f8f0024e275b2c7331a913be813699382b7ede0e16bbfe04f455ac7d3038e71914c5580b001bfdde591983ef9efbbb9a76e468c68813be724
7
- data.tar.gz: 6b3bcec0e9283052bf4af873e52faf60f3deda9d1ab72ee58082401a9a92b42fb322754e174c47a05df1f42942b9f92aaa86751bdeb7c7d69258549b9d26d34d
6
+ metadata.gz: 1a22a91076896a771067f9dd4a99d90d507f9dec39037f3654aae8a8990283f6004e29db74f1fec805c6a0e754912032f1ddf072e8c9e2e28dc96fa2ea269b48
7
+ data.tar.gz: e7e9fbb7ae2f999e6b9646b1266e9fb20dc6930518995ce61acd68edae78937d8a952e7b2dfcec6bf2b2528dfc29e33010a44a4cc5a52eb683647748cfaf39a3
@@ -199,6 +199,7 @@ win32_readlink(const char* file)
199
199
  return target;
200
200
  }
201
201
 
202
+ // Win32::Symlink::readlink(file)
202
203
  static VALUE
203
204
  rb_readlink(VALUE mod, VALUE file)
204
205
  {
@@ -208,6 +209,7 @@ rb_readlink(VALUE mod, VALUE file)
208
209
  return win32_readlink(RSTRING_PTR(file));
209
210
  }
210
211
 
212
+ // Win32::Symlink::symlink?(file)
211
213
  static VALUE
212
214
  rb_symlink_p(VALUE mod, VALUE file)
213
215
  {
@@ -237,6 +239,8 @@ is_directory(wchar_t* path)
237
239
  return false;
238
240
  }
239
241
 
242
+
243
+ // Win32::Symlink::symlink(file, symlink)
240
244
  static VALUE
241
245
  rb_symlink(VALUE mod, VALUE target, VALUE symlink)
242
246
  {
@@ -256,7 +260,7 @@ rb_symlink(VALUE mod, VALUE target, VALUE symlink)
256
260
  wtarget = filecp_to_wstr(RSTRING_PTR(target), NULL);
257
261
  wsymlink = filecp_to_wstr(RSTRING_PTR(symlink), NULL);
258
262
 
259
- if( is_directory(wsymlink) )
263
+ if( is_directory(wtarget) )
260
264
  {
261
265
  flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
262
266
  }
@@ -3,7 +3,7 @@ module Win32
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 2
6
+ PATCH = 3
7
7
  BUILD = nil
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join '.'
9
9
  end
@@ -4,6 +4,8 @@ $LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'ext')
4
4
 
5
5
  require 'test/unit'
6
6
  require 'win32/symlink'
7
+ require 'fileutils'
8
+
7
9
  include Win32
8
10
 
9
11
  class Errno::E4390 < SystemCallError
@@ -52,8 +54,25 @@ class TC_Win32Symlink < Test::Unit::TestCase
52
54
  end
53
55
  end
54
56
 
57
+ def test_makelink_directory
58
+ Dir.chdir(ENV["TMP"]) do
59
+ Dir.mkdir('symlink-test-directory-target')
60
+ IO::write('symlink-test-directory-target/simple-file', 'some content')
61
+
62
+ Symlink.symlink('symlink-test-directory-target', 'symlink-test-directory-symlink')
63
+
64
+ assert(Symlink.symlink?('symlink-test-directory-symlink'))
65
+
66
+ assert(File.readable?('symlink-test-directory-symlink/simple-file'))
67
+ end
68
+ end
69
+
55
70
  def teardown
56
- Dir.glob(File.join(ENV['TMP'], 'symlink-test*')).each {|f| File::unlink f}
71
+ tdir = File.join(ENV['TMP'], 'symlink-test*').gsub("\\", '/')
72
+
73
+ Dir.glob(tdir).each do |f|
74
+ FileUtils::rm_rf f
75
+ end
57
76
  end
58
77
 
59
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-symlink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Kropivnitsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler