ShowInFinder function in Cinema 4D S26

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.

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

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!

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

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!

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

@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