Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Delete File from Disc | GeKillFile() How?

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 471 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 25/09/2008 at 08:23, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R11 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hi there.
      I'm able to Write a new file into and read from UserPrefs.
      (The first commented part)
      But, I'm not able to figure out how to delete (erase from disc).
      What I have is the code below. I figure the GeKillFile() should be
      the route but I most likely miss something here.
      I do get the Yes and No printouts depending on if the name is
      correct or not.

      Cheers
      Lennart

      > \> /\* \> var fn = GeGetStartupWritePath()->Add("DAFILE.txt"); \> var file = new(BaseFile); \> \> { \> file->Open(fn,GE_WRITE); \> if (file) \> { \> file->WriteString("12345"); file->Close(); \> } \> } \> \> file->Open(fn,GE_READ); \> var code = file->ReadString(file->GetLength()); \> println(code); \> \*/ \> \> var fn = GeGetStartupWritePath()->Add("DAFILE.txt"); \> var is = GeFileExist(fn,FALSE); \> if(is) \>    { \>      println("YES and KILL It!"); \>      GeFileKill(fn,FALSE); \>    } \> else println("No such file, hold your guns"); \>

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 25/09/2008 at 15:29, xxxxxxxx wrote:

        Hm.. The code above actually works -if- the file is written from
        ScriptManager. Then I can Write, read and Kill it.
        But, If the file is written from a Plugin at startup of Cinema,
        nor can that plugin (when checking the string) or the Killcode
        from within ScriptManager delete the file from disc...

        What can I possible look for?
        While the file written is a "regular" .txt file, the creator in both
        cases (PluginWrite and ScriptWrite) is "CinemaR11".

        Cheers
        Lennart

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 25/09/2008 at 19:16, xxxxxxxx wrote:

          Is it possible that the file is not being closed properly at startup which results in its inability to be deleted (you can't delete a file in use by a process - with existing handles)? This may simply be a scope issue - COFFEE's 'cleanup' hasn't freed the BaseFile which hasn't relinquished its file handle by closing the file.

          Could you provide the startup code?

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 26/09/2008 at 02:41, xxxxxxxx wrote:

            Robert, thanks for checking.
            The code at startup is the same as above and all plugins that
            check for it later (on startup) can read it fine. The only difference
            when writing to disc would be that the string is read from a Dialoge that opens if the file isn't there to start with.

            I can write the file manually (and put it in the right place
            as I have done up till now) using a regular text pad.
            Even then the code can't kill it should I wish.

            Of coarse I can provide code if you think you might know what
            to check.

            Thanks
            Lennart

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 27/09/2008 at 14:49, xxxxxxxx wrote:

              Robert, you where absolutely right 🙂
              Among some other tidbits (loading mindwarps by me) the basefile
              was not properly closed after last check on startup of Cinema.

              Cheers
              Lennart

              1 Reply Last reply Reply Quote 0
              • First post
                Last post