Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    ShowInFinder function in Cinema 4D S26

    Cinema 4D SDK
    python
    3
    7
    804
    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.
    • A
      aturtur
      last edited by Manuel

      Hi, just noticed that ShowInFinder function in Cinema 4D S26 opens the parent directory instead of the given directory, like in previous C4D versions. Is this a known change or a bug?

      Here is an example script that should open the _bugreports folder

      import os
      import c4d
      from c4d import storage
      
      def main():
          folder = storage.GeGetC4DPath(c4d.C4D_PATH_PREFS)
          folder = os.path.dirname(folder)
          folder = os.path.join(folder, '_bugreports')     
          storage.ShowInFinder(folder)
      
      if __name__=='__main__':
          main()
      

      It works in Cinema 4D R25 (and older versions) but in S26 it opens the parent directory of _bugreports instead.

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hi,

        sorry i was not able to reproduce the issue on my mac. What OSX are you testing on? Intel or M1 (just in case)

        The parent directory is always displayed on my test. While if i pass True as the second parameter of the ShowInFinder function, it will display the directory itself.

        There is also a new method to retrieve the different Cinema 4D folders using the maxon api.

        maxon.Application.GetUrl(maxon.APPLICATION_URLTYPE.PREFS_DIR)
        

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • A
          aturtur
          last edited by

          Hi, sorry I totally forgot to tell the system specs. I did just a couple tests. Looks like it just was a Windows - Mac difference before.

          Windows 11 and Cinema 4D R26.013 -> Opens parent folder
          Windows 11 and Cinema 4D R25.117 -> Opens folder itself
          Windows 11 and Cinema 4D R21.207 -> Opens folder itself

          MacOS 12.3.1 (2018 MBP) and R26.013 -> Opens parent folder
          MacOS 12.3.1 (2018 MBP) and R21.207 -> Opens parent folder

          I'm gonna use following code to open straight to the folder location

          import os
          import c4d
          from c4d import storage
          
          def main():
          
              f = storage.GeGetC4DPath(c4d.C4D_PATH_PREFS) # Get preference folder path
              f = os.path.dirname(r''+f+'') # Go up
              f = os.path.join(f, '_bugreports') # Bug reports folder
              storage.ShowInFinder(f) # Open folder
          
              if c4d.GeGetCurrentOS() == c4d.OPERATINGSYSTEM_WIN: # If operating system is Windows
                  os.startfile(folder)
              else: # If operating system is Mac
                  os.system('open "%s"' % folder)
                  
          if __name__=='__main__':
              main()
          

          Thanks for pointing out!

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            Hi,

            Ok i was able to reproduce the issue on Windows 10. We can say that now, both OS are aligned and works the same, so i would not consider this as a bug. This is also how the button on preferences works, by showing the parent folder of the preferences.

            As i said adding True as the second parameter will open the right directory.

                storage.ShowInFinder(folder, True)
            

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            A 1 Reply Last reply Reply Quote 0
            • A
              aturtur @Manuel
              last edited by

              Hi, not sure how I missed the solution from your first post. I need to be more careful. Thanks and sorry for the confusion.

              storage.ShowInFinder(folder, True)
              

              Works prefectly. Cheers!

              1 Reply Last reply Reply Quote 0
              • a_blockA
                a_block
                last edited by

                I tend to use GeExecuteFile() to open directories in Explorer/Finder. This seems to work for me regardless of OS.
                Are there any advantages of using ShowInFinder() instead? Or any disadvantages of using GeExecuteFile().

                Cheers

                ManuelM 1 Reply Last reply Reply Quote 0
                • ManuelM
                  Manuel @a_block
                  last edited by Manuel

                  @a_block said in ShowInFinder function in Cinema 4D S26:

                  I tend to use GeExecuteFile() to open directories in Explorer/Finder. This seems to work for me regardless of OS.
                  Are there any advantages of using ShowInFinder() instead? Or any disadvantages of using GeExecuteFile().

                  Absolutely None, except that the name of the function makes more sense if you just want to show the directory. Thanks for pointing that out, i overlooked that line.

                  Bool ShowInFinder(const Filename& path, Bool open)
                  {
                  	if (open)
                  		return GeExecuteFile(path);
                  

                  Cheers,
                  Manuel

                  MAXON SDK Specialist

                  MAXON Registered Developer

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