How can you get the parent directory of a RegularF...
# community-support
p
How can you get the parent directory of a RegularFile as a Directory? Compared to Directory, RegularFile can do "nothing" except calling getAsFile.
v
Copy code
layout.dir(provider { file.asFile.parentFile })
Sounds like you should post a feature request maybe 😄
p
Yeah, definitely! This works and is my workaround too, but it requires a ProjectLayout and ProviderFactory.
v
Yep
j
Sometimes because of path sensitivity you'd probably need to use the absolute file to make it work properly.
Copy code
layout.dir(provider { file.asFile.absoluteFile.parentFile })
👆 1