Fix read_link to use a more appropiate api

Bug #907336 reported by Diego Sarmentero
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Client
Medium
Brian Curtin

Bug Description

shortcut.Targetpath is returning a malformed path when the paths contains unicode chars, but GetWorkingDirectory works just fine for this case (but we need to set the WorkingDirectory variable).

Now it was fixed using WorkingDirectory because all the links are created by us, but we should fix this in order to support the proper api and get the target of the link in a more accurate way.

* Read Link: We couldn't store the TargetPath correctly with unicode chars in the path for a shortcut on windows, we were able to create a shortcut with an unicode target, but we couldn't retrieve it. The workaround that we have in this moment involve saving the TargetPath in the WorkingDirectory attribute of the shortcut, and retrieve that value in the "read_link" function, because WorkingDirectory can handle unicode values without any problem. You can see the code at: u1-client/ubuntuone/platform/windows/os_helper.py > read_link
In this case we are using comtypes (that is a pure Python COM package based on the ctypes: http://starship.python.net/crew/theller/comtypes/), because with pywin32 we had several issues trying to create a shortcut with an unicode target, it seems the windows W functions are not properly wrapped in some cases, and trying to use pywin32, or a combination of pywin32 and ctypes only leads to shortcuts with an empty target or not target at all because the creation of the shortcut fails.

Leo Arias (elopio)
Changed in ubuntuone-client:
assignee: nobody → Ubuntu One Desktop+ team (ubuntuone-desktop+)
description: updated
Changed in ubuntuone-client:
assignee: Ubuntu One Desktop+ team (ubuntuone-desktop+) → Brian Curtin (brian.curtin)
status: New → Triaged
importance: Undecided → Medium
Changed in ubuntuone-client:
status: Triaged → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers