Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-unified-theme-switcher
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-unified-theme-switcher
Commits
34908761
Commit
34908761
authored
Dec 13, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hotfix: create_config: if system config exists, copy it to home
parent
64736aa5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
utils.py
src/utils.py
+9
-4
No files found.
src/utils.py
View file @
34908761
import
sys
,
os
,
re
import
sys
,
os
,
shutil
,
re
import
subprocess
import
functools
...
...
@@ -22,11 +22,16 @@ def create_config():
try
:
if
os
.
geteuid
()
==
0
:
os
.
makedirs
(
SYSTEM_CONFIG_DIR
,
exist_ok
=
True
)
open
(
SYSTEM_CONFIG_FILE
,
'a'
)
.
close
()
with
open
(
SYSTEM_CONFIG_FILE
,
'a'
):
pass
return
SYSTEM_CONFIG_FILE
else
:
os
.
makedirs
(
HOME_CONFIG_DIR
,
exist_ok
=
True
)
open
(
HOME_CONFIG_FILE
,
'a'
)
.
close
()
if
os
.
path
.
exists
(
SYSTEM_CONFIG_FILE
):
os
.
makedirs
(
HOME_CONFIG_DIR
,
exist_ok
=
True
)
shutil
.
copyfile
(
SYSTEM_CONFIG_FILE
,
HOME_CONFIG_FILE
)
else
:
os
.
makedirs
(
HOME_CONFIG_DIR
,
exist_ok
=
True
)
open
(
HOME_CONFIG_FILE
,
'a'
)
.
close
()
return
HOME_CONFIG_FILE
except
Exception
as
e
:
print
(
f
"Error creating config file: {e}"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment