[Win32utils-devel] [ win32utils-Bugs-29645 ] Fixes for: Char encode error & Dir::WINDOWS error

noreply at rubyforge.org noreply at rubyforge.org
Fri Jan 10 15:59:27 UTC 2014


Bugs item #29645, was opened at 2012-09-18 11:17
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=411&aid=29645&group_id=85

Category: win32-shortcut
Group: Code
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Harrison Uhl (harriso_uhl)
>Assigned to: Daniel Berger (djberg96)
Summary: Fixes for: Char encode error & Dir::WINDOWS error

Initial Comment:
Using Ruby 1.9.3 on Windows Vista

In trying example_shortcut.rb I kept getting Encoding errors.  I got past this by adding .encode("UTF-8") to Dir::DESKTOP  and  Dir::WINDOWS
 e.g. Dir::WINDOWS.encode("UTF-8")

I also found that the line:
   s.path = "c:\" << Dir::WINDOWS.encode("UTF-8") << "\notepad.exe"

added an extra c:\ at the start of the string -- which caused a 'method not found' error in the underlying shortcut.rb line 138.  Removing the extra c:\ got rid of the problem.  (I don't know if the extra c:\ is present for older Ruby or Windows.)

With the above changes I was able to create a shortcut.

If my fixes are appropriate, could someone please add them to the code base.

Thanks

Harrison

----------------------------------------------------------------------

>Comment By: Daniel Berger (djberg96)
Date: 2014-01-10 08:59

Message:
Right, Dir::WINDOWS (or any other constant) already includes the absolute path, so there's no need to prepend it with "C:/". That's a bug in the example code. I'll update it, thanks.

You shouldn't have encoding issues any longer with the latest win32-dir gem.



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=411&aid=29645&group_id=85


More information about the win32utils-devel mailing list