Skip to content

Commit 70d180a

Browse files
Hide symbolic links from tree view
Currently hiding symbolic links (example, /sdcard). It would be good to support this but I'll handle it later.
1 parent 224e1b4 commit 70d180a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

addons/android_device_explorer/device_explorer.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,17 @@ func _get_devices() -> Array[String]:
177177

178178
func _list_dir(path: String) -> Array:
179179
var args := ["shell"]
180+
var ls_cmd = "ls -1 -F '%s'" % path
180181
if path.begins_with(DATA_ROOT):
181-
args.append_array(["run-as", PACKAGE_NAME, "ls", "-1", "-p", path])
182+
args.append_array(["run-as", PACKAGE_NAME, ls_cmd])
182183
else:
183-
args.append("ls -1 -p '%s'" % path)
184+
args.append(ls_cmd)
184185

185186
var result := _run_adb(args)
186187
var files := []
187188
for line in result.split("\n"):
188189
line = line.strip_edges()
190+
if line.ends_with("@"): continue # Ignore links like /sdcard for now. I'll handle it later.
189191
if line == "" or line.begins_with("total"): continue
190192
files.append({"name": line.rstrip("/"), "is_dir": line.ends_with("/")})
191193
return files

0 commit comments

Comments
 (0)