wayne-chi commited on
Commit
5a423c7
·
verified ·
1 Parent(s): 932bba5

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +12 -3
streamlit_app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import stat
 
3
 
4
  def is_read_write_dir(path):
5
  return (
@@ -8,13 +9,21 @@ def is_read_write_dir(path):
8
  and os.access(path, os.W_OK)
9
  )
10
 
 
 
 
11
  rw_dirs = []
12
  for root, dirs, _ in os.walk("/"):
13
  for d in dirs:
14
- full_path = os.path.abspath(os.path.join(root, d))
15
  if is_read_write_dir(full_path):
 
16
  mode = stat.filemode(os.stat(full_path).st_mode)
17
  rw_dirs.append(f"{mode} {full_path}")
18
 
19
- for d in sorted(rw_dirs):
20
- print(d)
 
 
 
 
 
1
  import os
2
  import stat
3
+ import streamlit as st
4
 
5
  def is_read_write_dir(path):
6
  return (
 
9
  and os.access(path, os.W_OK)
10
  )
11
 
12
+ st.title("📂 Read + Write Directories")
13
+
14
+ # Walk the filesystem starting from root
15
  rw_dirs = []
16
  for root, dirs, _ in os.walk("/"):
17
  for d in dirs:
18
+ full_path = os.path.join(root, d)
19
  if is_read_write_dir(full_path):
20
+ # Get permissions in ls -ld style
21
  mode = stat.filemode(os.stat(full_path).st_mode)
22
  rw_dirs.append(f"{mode} {full_path}")
23
 
24
+ # Display them
25
+ if rw_dirs:
26
+ for d in sorted(rw_dirs):
27
+ st.write(d)
28
+ else:
29
+ st.write("No read-write directories found for the current user.")