If you're using my Ignition Extensions module, this is pretty trivial to do with the system.project.getProject() method:
from com.inductiveautomation.ignition.common.project.resource import ResourceType
from com.inductiveautomation.ignition.common.util import ResourceUtil
def getMostRecent(moduleId, typeId):
project = system.project.getProject()
allResources = [
resource
for resource in project.getResourcesOfType(ResourceType(moduleId, typeId))
if project.isLocal(resource.resourcePath) # note - this filter will only work in the designer
]
allResources.sort(cmp=ResourceUtil.SORT_BY_MOST_RECENT.compare)
return allResources
for resource in getMostRecent("com.inductiveautomation.vision", "windows"):
print resource.folderPath
If you don't/won't/can't use Ignition Extensions, you'll have to obtain a reference to the project in some other way. The two arguments to pass in can be obtained from the filesystem.