This repository was archived by the owner on Jun 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import os
2+ import requests
3+
4+ from windows .loading import LoadingWindow
5+
6+ def check_files ():
7+ loadingwindow = LoadingWindow ()
8+
9+ files = [
10+ "https://raw.githubusercontent.com/bentettmar/barnotes/main/data/icon.png" ,
11+ "https://raw.githubusercontent.com/bentettmar/barnotes/main/data/note.txt"
12+ ]
13+
14+ loadingwindow .update_text ("Checking files..." )
15+ if not os .path .exists (os .path .expanduser ("~/Library/Application Support/BarNotes" )):
16+ os .makedirs (os .path .expanduser ("~/Library/Application Support/BarNotes" ))
17+ loadingwindow .update_text ("Creating directory..." )
18+
19+ loadingwindow .update_text ("Downloading files..." )
20+ for file in files :
21+ if not os .path .exists (os .path .expanduser (f"~/Library/Application Support/BarNotes/{ file .split ('/' )[- 1 ]} " )):
22+ loadingwindow .update_text (f"Downloading { file .split ('/' )[- 1 ]} ..." )
23+ r = requests .get (file )
24+ with open (os .path .expanduser (f"~/Library/Application Support/BarNotes/{ file .split ('/' )[- 1 ]} " ), "wb" ) as f :
25+ f .write (r .content )
26+ loadingwindow .update_text (f"Downloaded { file .split ('/' )[- 1 ]} ..." )
27+
28+ loadingwindow .update_text ("Done!" )
29+ loadingwindow .destroy ()
You can’t perform that action at this time.
0 commit comments