getParentPath static method
- String path
Get parent directory path.
path - File or directory path.
Example: geopod/data/places/places.json → geopod/data/places/
Implementation
static String getParentPath(String path) {
final cleanPath = path.endsWith('/')
? path.substring(0, path.length - 1)
: path;
final lastSlash = cleanPath.lastIndexOf('/');
if (lastSlash <= 0) return '/';
return '${cleanPath.substring(0, lastSlash)}/';
}