mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
glocalvfs: Create a dummy file for g_file_new_for_path("")
`""` is not a valid path (`stat()` on it returns `ENOENT`). Previously, a full `GLocalFile` was being created, which ended up resolving to `$CWD`, through path canonicalisation. That isn’t right. Fix it by creating a `GDummyFile` instead, and adding a unit test. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #2328
This commit is contained in:
@@ -80,7 +80,10 @@ static GFile *
|
||||
g_local_vfs_get_file_for_path (GVfs *vfs,
|
||||
const char *path)
|
||||
{
|
||||
return _g_local_file_new (path);
|
||||
if (*path == '\0')
|
||||
return _g_dummy_file_new (path);
|
||||
else
|
||||
return _g_local_file_new (path);
|
||||
}
|
||||
|
||||
static GFile *
|
||||
|
Reference in New Issue
Block a user