Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nctool
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andri Joos
nctool
Commits
a6e86a25
Commit
a6e86a25
authored
1 year ago
by
Andri Joos
Browse files
Options
Downloads
Patches
Plain Diff
fix relative file path error
parent
9bf4502a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+6
-2
6 additions, 2 deletions
main.py
with
6 additions
and
2 deletions
main.py
+
6
−
2
View file @
a6e86a25
...
...
@@ -40,7 +40,9 @@ def create_client(server_address: str = None, username: str = None, password: st
def
upload
(
_in
:
str
,
out
:
str
,
server_address
:
str
=
None
,
username
:
str
=
None
,
password
:
str
=
None
,
public_link
:
str
=
None
,
func
=
None
):
nc
=
create_client
(
server_address
,
username
,
password
,
public_link
)
files_and_directories
=
glob
.
glob
(
os
.
path
.
join
(
_in
,
"
**/*
"
),
recursive
=
True
)
search_path
=
os
.
path
.
join
(
_in
,
"
**/*
"
)
if
os
.
path
.
isdir
(
_in
)
else
_in
files_and_directories
=
glob
.
glob
(
search_path
,
recursive
=
True
)
uploading_files
=
[
f
for
f
in
files_and_directories
if
os
.
path
.
isfile
(
f
)]
already_uploaded
=
[]
...
...
@@ -53,8 +55,10 @@ def upload(_in: str, out: str, server_address: str = None, username: str = None,
for
file_path
in
uploading_files
:
relative_file_path
=
os
.
path
.
relpath
(
file_path
,
_in
)
remote_file_path
=
os
.
path
.
join
(
out
,
relative_file_path
)
if
relative_file_path
==
"
.
"
:
relative_file_path
=
""
remote_file_path
=
os
.
path
.
join
(
out
,
relative_file_path
)
if
remote_file_path
not
in
already_uploaded_files
:
remote_dir_path
=
os
.
path
.
dirname
(
remote_file_path
)
create_remote_path_if_not_exists
(
remote_dir_path
,
nc
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment