RestartApplication() / c4d.RestartMe()



  • Hi there,

    I wonder if anyone knows about the parameters for the C++ API function RestartApplication() and its Python counterpart c4d.RestartMe().

    C++:
    void RestartApplication(const Utf16Char* param = nullptr, Int32 exitcode = 0, const Utf16Char** path = nullptr)

    Python:
    c4d.RestartMe(param=None, exitcode=0)

    What can I do with param, and - even more interesting - what can I do with C++'s path? I suspect that pathlets me start another application instead of Cinema 4D.

    I'm asking because I'm thinking about implementing a plugin updater that would, just like the C4D updater, be able to exit Cinema, and start an application instead that will update the plugin files.

    Thanks in advance!

    Cheers,
    Frank


  • Global Moderator

    Hi Frank,

    RestartApplication() won't help you here.
    Via param you can pass command line arguments to the restarted Cinema 4D.
    The exitcode is used as exit code for the quitting Cinema 4D.
    And path is actually highly system dependent. While being ignored on macOS, on Windows it will return the path of the running Cinema 4D instance.

    Couldn't you just start your plugin installer as a detached process and then quit Cinema 4D?

    Cheers,
    Andreas



  • @a_block said in RestartApplication() / c4d.RestartMe():

    RestartApplication() won't help you here.
    Via param you can pass command line arguments to the restarted Cinema 4D.
    The exitcode is used as exit code for the quitting Cinema 4D.
    And path is actually highly system dependent. While being ignored on macOS, on Windows it will return the path of the running Cinema 4D instance.

    Ah, ok, thanks! Maybe you could put that information into the SDK docs for the next update, for new generations of clueless developers? ;-)

    @a_block said in RestartApplication() / c4d.RestartMe():

    Couldn't you just start your plugin installer as a detached process and then quit Cinema 4D?

    I guess that's what it will come down to, yes.

    Thank you!


  • Global Moderator

    Sorry, in contrary to what I had written here before, we will not add RestartApplication() to the documentation. These calls have certain intricacies, so their use will be at own risk. This is now based on an answer from our development.
    Cheers,
    Andreas