2012-01-18 12:20:51 |
Diego Sarmentero |
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. |
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. |
|