rb-appscript 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/CHANGES +19 -0
  2. data/LICENSE +1 -1
  3. data/README +5 -5
  4. data/TODO +3 -1
  5. data/doc/aem-manual/01_introduction.html +2 -2
  6. data/doc/aem-manual/02_apioverview.html +2 -2
  7. data/doc/aem-manual/03_packingandunpackingdata.html +2 -2
  8. data/doc/aem-manual/04_references.html +9 -21
  9. data/doc/aem-manual/05_targettingapplications.html +3 -3
  10. data/doc/aem-manual/06_buildingandsendingevents.html +2 -2
  11. data/doc/aem-manual/07_findapp.html +2 -2
  12. data/doc/aem-manual/08_examples.html +3 -3
  13. data/doc/aem-manual/index.html +2 -2
  14. data/doc/appscript-manual/01_introduction.html +2 -2
  15. data/doc/appscript-manual/02_aboutappscripting.html +2 -2
  16. data/doc/appscript-manual/03_quicktutorial.html +2 -2
  17. data/doc/appscript-manual/04_gettinghelp.html +2 -2
  18. data/doc/appscript-manual/05_keywordconversion.html +2 -2
  19. data/doc/appscript-manual/06_classesandenums.html +2 -2
  20. data/doc/appscript-manual/07_applicationobjects.html +2 -2
  21. data/doc/appscript-manual/08_realvsgenericreferences.html +2 -2
  22. data/doc/appscript-manual/09_referenceforms.html +3 -3
  23. data/doc/appscript-manual/10_referenceexamples.html +2 -2
  24. data/doc/appscript-manual/11_applicationcommands.html +2 -2
  25. data/doc/appscript-manual/12_commandexamples.html +2 -2
  26. data/doc/appscript-manual/13_performanceissues.html +2 -2
  27. data/doc/appscript-manual/14_notes.html +2 -2
  28. data/doc/appscript-manual/index.html +2 -2
  29. data/doc/{appscript-manual/full.css → full.css} +0 -0
  30. data/doc/index.html +2 -2
  31. data/doc/mactypes-manual/index.html +2 -2
  32. data/doc/osax-manual/index.html +6 -6
  33. data/extconf.rb +13 -3
  34. data/rb-appscript.gemspec +2 -1
  35. data/src/lib/_aem/aemreference.rb +22 -31
  36. data/src/lib/_aem/codecs.rb +21 -19
  37. data/src/lib/_aem/connect.rb +7 -3
  38. data/src/lib/_aem/findapp.rb +7 -3
  39. data/src/lib/_aem/mactypes.rb +22 -14
  40. data/src/lib/_aem/send.rb +7 -3
  41. data/src/lib/_aem/typewrappers.rb +7 -3
  42. data/src/lib/_appscript/defaultterminology.rb +7 -3
  43. data/src/lib/_appscript/referencerenderer.rb +7 -3
  44. data/src/lib/_appscript/reservedkeywords.rb +8 -3
  45. data/src/lib/_appscript/safeobject.rb +12 -2
  46. data/src/lib/_appscript/terminology.rb +31 -15
  47. data/src/lib/aem.rb +8 -3
  48. data/src/lib/appscript.rb +74 -46
  49. data/src/lib/osax.rb +7 -6
  50. data/src/rbae.c +46 -77
  51. data/test/test_aemreference.rb +10 -4
  52. data/test/test_appscriptcommands.rb +3 -1
  53. data/test/test_appscriptreference.rb +5 -3
  54. data/test/test_codecs.rb +3 -1
  55. data/test/test_findapp.rb +3 -1
  56. data/test/test_mactypes.rb +12 -6
  57. data/test/test_osax.rb +3 -6
  58. metadata +44 -38
  59. data/doc/aem-manual/full.css +0 -21
@@ -5,7 +5,7 @@
5
5
  <title>appscript | 10. Reference Examples</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -138,6 +138,6 @@ app('TextEdit').documents[1].text.paragraphs[1].before</code></pre>
138
138
  </div>
139
139
 
140
140
  <!--footer-->
141
- <p class="footer">&copy; 2007 HAS</p>
141
+ <p class="footer">&copy; 2006-2008 HAS</p>
142
142
  </body>
143
143
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>appscript | 11. Application Commands</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -201,6 +201,6 @@ print d
201
201
  </div>
202
202
 
203
203
  <!--footer-->
204
- <p class="footer">&copy; 2007 HAS</p>
204
+ <p class="footer">&copy; 2006-2008 HAS</p>
205
205
  </body>
206
206
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>appscript | 12. Command Examples</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -124,6 +124,6 @@ app('Address Book').people[
124
124
  </div>
125
125
 
126
126
  <!--footer-->
127
- <p class="footer">&copy; 2007 HAS</p>
127
+ <p class="footer">&copy; 2006-2008 HAS</p>
128
128
  </body>
129
129
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>appscript | 13. Performance Issues</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -113,6 +113,6 @@ p result</code></pre>
113
113
  </div>
114
114
 
115
115
  <!--footer-->
116
- <p class="footer">&copy; 2007 HAS</p>
116
+ <p class="footer">&copy; 2006-2008 HAS</p>
117
117
  </body>
118
118
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>appscript | 14. Notes</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -84,6 +84,6 @@ require 'appscript'
84
84
  </div>
85
85
 
86
86
  <!--footer-->
87
- <p class="footer">&copy; 2007 HAS</p>
87
+ <p class="footer">&copy; 2006-2008 HAS</p>
88
88
  </body>
89
89
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>appscript | Contents</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -43,6 +43,6 @@
43
43
  </div>
44
44
 
45
45
  <!--footer-->
46
- <p class="footer">&copy; 2007 HAS</p>
46
+ <p class="footer">&copy; 2006-2008 HAS</p>
47
47
  </body>
48
48
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>Appscript Documentation</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(appscript-manual/full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -26,6 +26,6 @@
26
26
  </div>
27
27
 
28
28
  <!--footer-->
29
- <p class="footer">&copy; 2007 HAS</p>
29
+ <p class="footer">&copy; 2006-2008 HAS</p>
30
30
  </body>
31
31
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>mactypes</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(../appscript-manual/full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -251,6 +251,6 @@ MacTypes::Alias.path('/some/non/existent/location')
251
251
  </div>
252
252
 
253
253
  <!--footer-->
254
- <p class="footer">&copy; 2007 HAS</p>
254
+ <p class="footer">&copy; 2006-2008 HAS</p>
255
255
  </body>
256
256
  </html>
@@ -5,7 +5,7 @@
5
5
  <title>osax</title>
6
6
 
7
7
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
- <style type="text/css" media="all"><!--@import url(../appscript-manual/full.css);--></style>
8
+ <style type="text/css" media="all"><!--@import url(../full.css);--></style>
9
9
 
10
10
  </head>
11
11
  <body>
@@ -37,7 +37,7 @@ sa.say("Hello world", :using=&gt;"Victoria")</code></pre>
37
37
 
38
38
  <p>The default application commands (<code>run</code>, <code>activate</code>, <code>quit</code>, etc.) are also available; see the appscript manual for details on those.</p>
39
39
 
40
- <p>By default, <code>ScriptingAddition</code> objects are targetted at the current application. You can obtain a <code>ScriptingAddition</code> object targetted at another application by calling one of its <code>by...</code> methods.</p>
40
+ <p>By default, <code>ScriptingAddition</code> objects are targeted at the current application. You can obtain a <code>ScriptingAddition</code> object targeted at another application by calling one of its <code>by...</code> methods.</p>
41
41
 
42
42
 
43
43
 
@@ -108,7 +108,7 @@ osax.another_command</code></pre>
108
108
  Constructors:
109
109
 
110
110
  ScriptingAddition.new(name, terms=nil) -- make a ScriptingAddition
111
- object for the specified scripting addition, targetted
111
+ object for the specified scripting addition, targeted
112
112
  at the current application
113
113
 
114
114
  name: string -- a scripting addition's name,
@@ -131,7 +131,7 @@ osax.another_command</code></pre>
131
131
  # Specifying a different target application:
132
132
 
133
133
  # Each of the following methods returns a new ScriptingAddition
134
- # instance targetted at the specified application. The arguments
134
+ # instance targeted at the specified application. The arguments
135
135
  # are the same as for the by_name, by_creator, etc. methods in
136
136
  # appscript.
137
137
 
@@ -178,7 +178,7 @@ p sa.display_dialog("Ruby says hello!",
178
178
 
179
179
  <h3>GUI interaction</h3>
180
180
 
181
- <p>When using scripting addition commands that require GUI access (e.g. <code>display_dialog</code>) targetted at the command-line Ruby interpreter, the osax module will automatically convert the non-GUI interpreter process into a full GUI process to allow these commands to operate correctly. If you want to avoid this, target these commands at a faceless GUI application such as System Events instead:</p>
181
+ <p>When using scripting addition commands that require GUI access (e.g. <code>display_dialog</code>) targeted at the command-line Ruby interpreter, the osax module will automatically convert the non-GUI interpreter process into a full GUI process to allow these commands to operate correctly. If you want to avoid this, target these commands at a faceless GUI application such as System Events instead:</p>
182
182
 
183
183
  <pre><code>sa = OSAX.osax("StandardAdditions", "System Events")
184
184
  sa.activate # give focus to System Events
@@ -219,6 +219,6 @@ sa = OSAX::ScriptingAddition.new('StandardAdditions', StandardAdditions)</code><
219
219
  </div>
220
220
 
221
221
  <!--footer-->
222
- <p class="footer">&copy; 2007 HAS</p>
222
+ <p class="footer">&copy; 2006-2008 HAS</p>
223
223
  </body>
224
224
  </html>
data/extconf.rb CHANGED
@@ -35,9 +35,18 @@ $LDFLAGS << ' -framework Carbon -framework ApplicationServices'
35
35
 
36
36
  # Avoid `ID' and `T_DATA' symbol collisions between Ruby and Carbon.
37
37
  # (adapted code from RubyAEOSA - FUJIMOTO Hisakuni <hisa -at- fobj - com>)
38
- ruby_h = "#{Config::CONFIG['archdir']}/ruby.h"
39
- intern_h = "#{Config::CONFIG['archdir']}/intern.h"
38
+
39
+ maj, min, rev = RUBY_VERSION.split('.')
40
+ is_ruby_18 = (maj == '1' and min.to_i < 9)
41
+ if is_ruby_18
42
+ header_path = Config::CONFIG['archdir']
43
+ else
44
+ header_path = File.join(Config::CONFIG['rubyhdrdir'], 'ruby')
45
+ end
46
+ ruby_h = File.join(header_path, 'ruby.h')
47
+ intern_h = File.join(header_path, 'intern.h')
40
48
  new_filename_prefix = 'osx_'
49
+
41
50
  [ ruby_h, intern_h ].each do |src_path|
42
51
  dst_fname = File.join('./src', new_filename_prefix + File.basename(src_path))
43
52
  $stderr.puts "create #{File.expand_path(dst_fname)} ..."
@@ -45,7 +54,8 @@ new_filename_prefix = 'osx_'
45
54
  IO.foreach(src_path) do |line|
46
55
  line = line.gsub(/\bID\b/, 'RB_ID')
47
56
  line = line.gsub(/\bT_DATA\b/, 'RB_T_DATA')
48
- line = line.gsub(/\bintern.h\b/, "#{new_filename_prefix}intern.h")
57
+ line = line.gsub(/\b(?:ruby\/)?intern.h\b/, "#{new_filename_prefix}intern.h")
58
+ line = line.gsub('#include "defines.h"', '#include "ruby/defines.h"') if not is_ruby_18
49
59
  dstfile.puts line
50
60
  end
51
61
  end
@@ -2,7 +2,7 @@ require "rubygems"
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = "rb-appscript"
5
- s.version = "0.5.0"
5
+ s.version = "0.5.1"
6
6
  s.author = "HAS"
7
7
  s.homepage = "http://rb-appscript.rubyforge.org/"
8
8
  s.rubyforge_project="rb-appscript"
@@ -10,6 +10,7 @@ spec = Gem::Specification.new do |s|
10
10
  s.files = Dir["**/*"].delete_if { |name| ["MakeFile", "ae.bundle", "mkmf.log", "rbae.o", "SendThreadSafe.o", "src/osx_ruby.h", "src/osx_intern.h"].include?(name) }
11
11
  s.extensions = "extconf.rb"
12
12
  s.test_files = Dir["test/test_*.rb"]
13
+ # s.platform = Gem::Platform::CURRENT
13
14
  s.required_ruby_version = ">= 1.8"
14
15
  end
15
16
 
@@ -1,6 +1,10 @@
1
- #!/usr/local/bin/ruby -w
2
- # Copyright (C) 2006 HAS.
3
- # Released under MIT License.
1
+ #
2
+ # rb-appscript
3
+ #
4
+ # aemreference -- an object-oriented API for constructing object specifier AEDescs
5
+ #
6
+ # Copyright (C) 2006-2008 HAS. Released under MIT License.
7
+ #
4
8
 
5
9
  ######################################################################
6
10
  # Endianness support
@@ -277,25 +281,6 @@ module AEMReference
277
281
  def is_in(val)
278
282
  return IsIn.new(self, val)
279
283
  end
280
-
281
- # Logic tests; these should only be used on its-based references:
282
-
283
- # Note: these are convenience methods allowing boolean tests to be written in shorthand form;
284
- # e.g. AEM.its.visible.and(...) will automatically expand to AEM.its.visible.eq(true).and(...)
285
- # The Test class implements the actual logic test methods
286
-
287
- def and(*operands)
288
- return Equals.new(self, true).and(*operands)
289
- end
290
-
291
- def or(*operands)
292
- return Equals.new(self, true).or(*operands)
293
- end
294
-
295
- def not
296
- return Equals.new(self, true).not
297
- end
298
-
299
284
 
300
285
  # Insertion references:
301
286
 
@@ -566,11 +551,6 @@ module AEMReference
566
551
  KeyForm = AEMReference.pack_enum(KAE::FormRange)
567
552
 
568
553
  def initialize(wantcode, container, key)
569
- key.each do |item|
570
- if not (item.is_a?(Specifier) and item.AEM_root != Its)
571
- raise TypeError, "Bad selector: not an application (app) or container (con) based reference: #{item.inspect}"
572
- end
573
- end
574
554
  super(wantcode, container.AEM_true_self, key)
575
555
  end
576
556
 
@@ -579,10 +559,21 @@ module AEMReference
579
559
  end
580
560
 
581
561
  def _pack_key(codecs)
582
- return AEMReference.pack_list_as(KAE::TypeRangeDescriptor, [
583
- [KAE::KeyAERangeStart, codecs.pack(@_key[0])],
584
- [KAE::KeyAERangeStop, codecs.pack(@_key[1])]
585
- ])
562
+ range_selectors = [
563
+ [KAE::KeyAERangeStart, @_key[0]],
564
+ [KAE::KeyAERangeStop, @_key[1]]
565
+ ].collect do |key, selector|
566
+ case selector
567
+ when Specifier
568
+ # use selector as-is (note: its-based roots aren't appropriate, but this isn't checked for)
569
+ when String
570
+ selector = AEMReference::Con.elements(@AEM_want).by_name(selector)
571
+ else
572
+ selector = AEMReference::Con.elements(@AEM_want).by_index(selector)
573
+ end
574
+ [key, codecs.pack(selector)]
575
+ end
576
+ return AEMReference.pack_list_as(KAE::TypeRangeDescriptor, range_selectors)
586
577
  end
587
578
 
588
579
  def AEM_resolve(obj)
@@ -1,6 +1,10 @@
1
- #!/usr/local/bin/ruby
2
- # Copyright (C) 2006 HAS.
3
- # Released under MIT License.
1
+ #
2
+ # rb-appscript
3
+ #
4
+ # codecs -- convert native Ruby objects to AEDescs, and vice-versa
5
+ #
6
+ # Copyright (C) 2006-2008 HAS. Released under MIT License.
7
+ #
4
8
 
5
9
  require "ae"
6
10
  require "kae"
@@ -80,7 +84,7 @@ class UnitTypeCodecs
80
84
 
81
85
  def pack(val)
82
86
  if val.is_a?(MacTypes::Units)
83
- code, packer = @type_by_name.fetch(val.type) { |val| raise IndexError, "Unknown unit type: #{val.inspect}" }
87
+ code, packer = @type_by_name.fetch(val.type) { |v| raise IndexError, "Unknown unit type: #{v.inspect}" }
84
88
  return [true, packer.call(val, code)]
85
89
  else
86
90
  return [false, val]
@@ -88,7 +92,7 @@ class UnitTypeCodecs
88
92
  end
89
93
 
90
94
  def unpack(desc)
91
- name, unpacker = @type_by_code.fetch(desc.type) { |desc| return [false, desc] }
95
+ name, unpacker = @type_by_code.fetch(desc.type) { |d| return [false, d] }
92
96
  return [true, unpacker.call(desc, name)]
93
97
  end
94
98
  end
@@ -168,7 +172,16 @@ class Codecs
168
172
  case val
169
173
  when AEMReference::Base then val.AEM_pack_self(self)
170
174
 
171
- when Fixnum then AE::AEDesc.new(KAE::TypeSInt32, [val].pack('l'))
175
+ when Fixnum, Bignum then
176
+ if SInt32Bounds === val
177
+ AE::AEDesc.new(KAE::TypeSInt32, [val].pack('l'))
178
+ elsif SInt64Bounds === val
179
+ AE::AEDesc.new(KAE::TypeSInt64, [val].pack('q'))
180
+ elsif UInt64Bounds === val
181
+ pack_uint64(val)
182
+ else
183
+ AE::AEDesc.new(KAE::TypeFloat, [val.to_f].pack('d'))
184
+ end
172
185
 
173
186
  when String then
174
187
  begin
@@ -213,17 +226,6 @@ class Codecs
213
226
  AE::AEDesc.new(KAE::TypeKeyword, Codecs.four_char_code(val.code))
214
227
 
215
228
  when AE::AEDesc then val
216
-
217
- when Bignum
218
- if SInt32Bounds === val
219
- AE::AEDesc.new(KAE::TypeSInt32, [val].pack('l'))
220
- elsif SInt64Bounds === val
221
- AE::AEDesc.new(KAE::TypeSInt64, [val].pack('q'))
222
- elsif UInt64Bounds === val
223
- pack_uint64(val)
224
- else
225
- AE::AEDesc.new(KAE::TypeFloat, [val.to_f].pack('d'))
226
- end
227
229
 
228
230
  when NilClass then NullDesc
229
231
  else
@@ -394,8 +396,8 @@ class Codecs
394
396
  key, value = desc.get_item(i + 1, KAE::TypeWildCard)
395
397
  if key == KAE::KeyASUserRecordFields
396
398
  lst = unpack_aelist(value)
397
- (lst.length / 2).times do |i|
398
- dct[lst[i * 2]] = lst[i * 2 + 1]
399
+ (lst.length / 2).times do |j|
400
+ dct[lst[j * 2]] = lst[j * 2 + 1]
399
401
  end
400
402
  else
401
403
  dct[TypeWrappers::AEType.new(key)] = unpack(value)
@@ -1,6 +1,10 @@
1
- #!/usr/bin/ruby
2
- # Copyright (C) 2006 HAS.
3
- # Released under MIT License.
1
+ #
2
+ # rb-appscript
3
+ #
4
+ # connect -- launch applications and create AEAddressDescs
5
+ #
6
+ # Copyright (C) 2006-2008 HAS. Released under MIT License.
7
+ #
4
8
 
5
9
  module Connect
6
10
  # Creates Apple event descriptor records of typeProcessSerialNumber, typeKernelProcessID and typeApplicationURL, used to specify the target application in Send::Event constructor.
@@ -1,6 +1,10 @@
1
- #!/usr/local/bin/ruby
2
- # Copyright (C) 2006 HAS.
3
- # Released under MIT License.
1
+ #
2
+ # rb-appscript
3
+ #
4
+ # findapp -- locate an application by name, bundle ID or creator code
5
+ #
6
+ # Copyright (C) 2006-2008 HAS. Released under MIT License.
7
+ #
4
8
 
5
9
  module FindApp
6
10
  # Support module for obtaining the full path to a local application given its name, bundle id or creator type. If application isn't found, an ApplicationNotFoundError exception is raised.
@@ -1,6 +1,10 @@
1
- #!/usr/local/bin/ruby -w
2
- # Copyright (C) 2006 HAS.
3
- # Released under MIT License.
1
+ #
2
+ # rb-appscript
3
+ #
4
+ # mactypes -- Ruby classes representing Alias, FileURL and unit type AEDescs
5
+ #
6
+ # Copyright (C) 2006-2008 HAS. Released under MIT License.
7
+ #
4
8
 
5
9
  module MacTypes
6
10
  # Defines wrapper classes for Mac OS datatypes that don't have a suitable Ruby equivalent.
@@ -10,6 +14,10 @@ module MacTypes
10
14
  require "ae"
11
15
  require "kae"
12
16
 
17
+ KCFURLPOSIXPathStyle = 0
18
+ KCFURLHFSPathStyle = 1
19
+ KCFURLWindowsPathStyle = 2
20
+
13
21
  class FileBase
14
22
 
15
23
  def FileBase._coerce(desc, type, path=nil)
@@ -57,20 +65,20 @@ module MacTypes
57
65
  def Alias.path(path)
58
66
  # Make Alias object from POSIX path.
59
67
  return new(FileBase._coerce(
60
- AE::AEDesc.new(KAE::TypeFileURL, AE.convert_posix_path_to_url(path)),
68
+ AE::AEDesc.new(KAE::TypeFileURL, AE.convert_path_to_url(path, KCFURLPOSIXPathStyle)),
61
69
  KAE::TypeAlias, path))
62
70
  end
63
71
 
64
72
  def Alias.hfs_path(path)
65
73
  # Make Alias object from HFS path.
66
74
  return new(FileBase._coerce(
67
- AE::AEDesc.new(KAE::TypeFileURL, AE.convert_hfs_path_to_url(path)),
75
+ AE::AEDesc.new(KAE::TypeFileURL, AE.convert_path_to_url(path, KCFURLHFSPathStyle)),
68
76
  KAE::TypeAlias, path))
69
77
  end
70
78
 
71
79
  def Alias.url(url)
72
80
  # Make Alias object from file URL. Note: only the path portion of the URL is used; the domain will always be localhost.
73
- return Alias.path(AE.convert_url_to_posix_path(url))
81
+ return Alias.path(AE.convert_url_to_path(url, KCFURLPOSIXPathStyle))
74
82
  end
75
83
 
76
84
  def Alias.desc(desc)
@@ -89,12 +97,12 @@ module MacTypes
89
97
 
90
98
  def path
91
99
  # Get as POSIX path.
92
- return AE.convert_url_to_posix_path(FileBase._coerce(@desc, KAE::TypeFileURL).data)
100
+ return AE.convert_url_to_path(FileBase._coerce(@desc, KAE::TypeFileURL).data, KCFURLPOSIXPathStyle)
93
101
  end
94
102
 
95
103
  def hfs_path
96
104
  # Get as HFS path.
97
- return AE.convert_url_to_hfs_path(FileBase._coerce(@desc, KAE::TypeFileURL).data)
105
+ return AE.convert_url_to_path(FileBase._coerce(@desc, KAE::TypeFileURL).data, KCFURLHFSPathStyle)
98
106
  end
99
107
 
100
108
  alias_method :to_s, :path
@@ -135,12 +143,12 @@ module MacTypes
135
143
 
136
144
  def FileURL.hfs_path(path)
137
145
  # Make FileURL object from HFS path.
138
- return new(AE.convert_url_to_posix_path(AE.convert_hfs_path_to_url(path)), nil)
146
+ return new(AE.convert_url_to_path(AE.convert_path_to_url(path, KCFURLHFSPathStyle), KCFURLPOSIXPathStyle), nil)
139
147
  end
140
148
 
141
149
  def FileURL.url(url)
142
150
  # Make FileURL object from file URL. Note: only the path portion of the URL is used; the domain will always be localhost.
143
- return FileURL.path(AE.convert_url_to_posix_path(url))
151
+ return FileURL.path(AE.convert_url_to_path(url, KCFURLPOSIXPathStyle))
144
152
  end
145
153
 
146
154
  def FileURL.desc(desc)
@@ -151,9 +159,9 @@ module MacTypes
151
159
  # Methods
152
160
 
153
161
  def desc
154
- # Get as AEDesc. If constructed from Ruby, descriptor's type is always typeFileURL; if returned by aem, its type mat be typeFSS, typeFSRef or typeFileURL.
162
+ # Get as AEDesc. If constructed from Ruby, descriptor's type is always typeFileURL; if returned by aem, its type may be typeFSS, typeFSRef or typeFileURL.
155
163
  if not @desc
156
- @desc = AE::AEDesc.new(KAE::TypeFileURL, AE.convert_posix_path_to_url(@path))
164
+ @desc = AE::AEDesc.new(KAE::TypeFileURL, AE.convert_path_to_url(@path, KCFURLPOSIXPathStyle))
157
165
  end
158
166
  return @desc
159
167
  end
@@ -166,13 +174,13 @@ module MacTypes
166
174
  def path
167
175
  # Get as POSIX path.
168
176
  if not @path
169
- @path = AE.convert_url_to_posix_path(FileBase._coerce(@desc, KAE::TypeFileURL).data)
177
+ @path = AE.convert_url_to_path(FileBase._coerce(@desc, KAE::TypeFileURL).data, KCFURLPOSIXPathStyle)
170
178
  end
171
179
  return @path
172
180
  end
173
181
 
174
182
  def hfs_path
175
- return AE.convert_url_to_hfs_path(AE.convert_posix_path_to_url(path))
183
+ return AE.convert_url_to_path(AE.convert_path_to_url(path, KCFURLPOSIXPathStyle), KCFURLHFSPathStyle)
176
184
  end
177
185
 
178
186
  alias_method :to_s, :path