[izpack-dev] Solution for Path problems when using Native Libraries on Windows XP in latin languages that have accents and other characters.

37 views
Skip to first unread message

Thiago

unread,
Aug 23, 2012, 8:47:08 AM8/23/12
to d...@izpack.codehaus.org
Hey there I´m here as a user requesting a bug fix that had a solution proposed by another user a long time ago.
Using izpack to create a installer for my system and testing it on Windows XP I found a problem when uninstalling my application.
The register in the Windows Installed application list is not cleaned up.

I found this email thread
http://old.nabble.com/Windows-XP-Registry-Entries-cleaning-up-td11630532.html

I figured out that most references of people having the same problem were almost all from my country, Brazil. And in the link above, a brazilian user debugging izpack found the bug in the source code of the Librarian.java class in the method getNativePath and proposed a solution that worked for me perfectly but after a long time the solution was not integrated to the main stream code.

The problem was found by a brazilian because Windows XP PT-Br uses accents in the pathname like "Local Configurations" in portuguese is "Configurações Locais", and the method getNativePath  fails when looking for the native lib in a subpath of this location. So   when uninstalling, the dll is not found and the Application remains in the Windows Registry.

The solution proposed by Daniel Silva-3  is the following and it worked for me.

private String getNativePath(String name, NativeLibraryClient client)
    {
        ProtectionDomain domain = client.getClass().getProtectionDomain();
        CodeSource codeSource = domain.getCodeSource();
        URL url = codeSource.getLocation();
        String path = url.getPath();
        path = path + nativeDirectory + '/' + name + extension;
        path = path.replace('/', File.separatorChar);
        // Revise the URI-path to a file path; needed in uninstaller because it
        // writes the jar contents into a sandbox; may be with blanks in the
        // path.
        //path = revisePath(path);    
/*Solution proposed***********************/
        try {                                   
            path = URLDecoder.decode(path,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            path = revisePath(path);
        }
/************************************/        

        return (path);
    }

Could someone of you intregate it to the next release of izPack, please ?

Reply all
Reply to author
Forward
0 new messages