AppImageCommunity / libappimage

Implements functionality for dealing with AppImage files
https://appimage.org
Other
46 stars 29 forks source link

Be more precise on how to use appimage_registered_desktop_file_path() #185

Open darealshinji opened 1 year ago

darealshinji commented 1 year ago

The comment in appimage.h isn't clear on what char* md5 is for and doesn't tell me that the returned string should (apparently) be free()d later:

/*
 * Finds the desktop file of a registered AppImage and returns the path
 * Returns NULL if the desktop file can't be found, which should only occur when the AppImage hasn't been registered yet
 */
char* appimage_registered_desktop_file_path(const char* path, char* md5, bool verbose);

This is a piece of code where I use it. I hope it's used correct.

    char *ptr = appimage_registered_desktop_file_path(to.c_str(), NULL, true);

    if (ptr) {
        std::cout << "Desktop file installed at \"" << ptr << "\"" << std::endl;
        free((void *)ptr);
    }