Bugs: Browse | Submit New | Admin

[#29645] Fixes for: Char encode error & Dir::WINDOWS error

Date:
2012-09-18 18:17
Priority:
3
Submitted By:
Harrison Uhl (harriso_uhl)
Assigned To:
Daniel Berger (djberg96)
Category:
win32-shortcut
State:
Closed
Summary:
Fixes for: Char encode error & Dir::WINDOWS error

Detailed description
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

Add A Comment: Notepad

Please login


Followup

Message
Date: 2014-01-10 15:59
Sender: Daniel Berger

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.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
close_date2014-01-10 15:592014-01-10 15:59djberg96
assigned_tonone2014-01-10 15:59djberg96
resolution_idNone2014-01-10 15:59djberg96
status_idOpen2014-01-10 15:59djberg96