Copy link to clipboard
Copied
I need to get the exact file name of the currently loaded AEP file. The problem I am finding is that when there is a space, the file name is normalized to include %20 in some places, and just spaces in others. What this means if I have two files on disk:
Test 1.aep
Test%201.aep
And I open each one, both have an identical displayName, and both have an identical name property, even though they are actually different files. How do I get the /actual/ file on disk? I have a suspicion this is a bug in After Effects.
=== Test 1.aep File properties ===
absoluteURI=/d/AEProjects/Test1/Test%201.aep
displayName=Test 1.aep
name=Test%201.aep
fsName=D:\AEProjects\Test1\Test 1.aep
fullName=/d/AEProjects/Test1/Test 1.aep
localizedName=undefined
path=/d/AEProjects/Test1
relativeURI=/d/AEProjects/Test1/Test%201.aep
=== Test%201.aep File properties ===
absoluteURI=/d/AEProjects/Test1/Test%201.aep
displayName=Test 1.aep
name=Test%201.aep
fsName=D:\AEProjects\Test1\Test 1.aep
fullName=/d/AEProjects/Test1/Test 1.aep
localizedName=undefined
path=/d/AEProjects/Test1
relativeURI=/d/AEProjects/Test1/Test%201.aep
Copy link to clipboard
Copied
Probably a limitation in Windows itself more than anything else. I believe there's there's a group policy setting to enforce strict URIs, but that doesn't do you any good since you have no control over it. That being the case you simply have to avoid such scenarios. On second thought, perhaps there may also be a way to add some testing with an extra URI decode loop...
Mylenium
Copy link to clipboard
Copied
Thanks for the response!
% is a valid character of FAT file systems (and all others as well): https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system#Directory_table
The fact that I load project "Test%201.aep" into After Effects, I would expect fsName to be the same. But After Effects incorrectly tells me fsName is "Test 1.aep". Because it is an incorrect reference for the project file, this means it is impossible to get to get an accurate reference to the actual project file in all cases.
For file "Test%201.aep", the reference of "absoluteURI=/d/AEProjects/Test1/Test%201.aep" is also incorrect. The percent sign should have been properly encoded: "absoluteURI=/d/AEProjects/Test1/Test%25201.aep".
Are there any work-arounds in After Effects? Or am I just stuck with this AE bug -- AE scripting doesn't support spaces in file names? This makes me wonder if AE does this for other special characters also.
Thanks!
Copy link to clipboard
Copied
When in doubt, use File.decode() method:
File.decode('Test%201.aep') // Test 1.aep
Copy link to clipboard
Copied
Sorry, I am not sure I follow...
If the real file name on disk is 'Test%201.aep', and fsName incorrectly tells me 'Test 1.aep', how does File.decode help get the real file name on disk from within AE? Also how does it help disambinguate a real file name on disk which is 'Test 1.aep', and fsName reports the same value?