Commit
·
5120e2f
1
Parent(s):
bbef4d5
Update app.py
Browse files
app.py
CHANGED
|
@@ -146,14 +146,18 @@ def write_file(file_path, content):
|
|
| 146 |
# return href
|
| 147 |
|
| 148 |
def download_file(file_path, content):
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
|
| 159 |
# Function to append to a file
|
|
|
|
| 146 |
# return href
|
| 147 |
|
| 148 |
def download_file(file_path, content):
|
| 149 |
+
try:
|
| 150 |
+
# Get the user's desktop directory
|
| 151 |
+
path = "/Users/konyeach"
|
| 152 |
+
desktop_dir = os.path.join(path, 'Desktop')
|
| 153 |
+
|
| 154 |
+
# Write the input to a new file on the desktop
|
| 155 |
+
with open(os.path.join(desktop_dir, file_path), "w") as f:
|
| 156 |
+
f.write(content)
|
| 157 |
+
|
| 158 |
+
return "File saved to desktop!"
|
| 159 |
+
except:
|
| 160 |
+
return "Error occurred while writing to file."
|
| 161 |
|
| 162 |
|
| 163 |
# Function to append to a file
|