mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +03:00
Nautilus integration: Work with python2 and python3
This commit is contained in:
parent
f254ee3211
commit
72363155d8
1 changed files with 7 additions and 3 deletions
|
@ -15,9 +15,13 @@
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
# for more details.
|
# for more details.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
python3 = sys.version_info[0] >= 3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import urllib
|
import urllib
|
||||||
import urllib.parse
|
if python3:
|
||||||
|
import urllib.parse
|
||||||
import socket
|
import socket
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
@ -31,11 +35,11 @@ appname = 'ownCloud'
|
||||||
|
|
||||||
print("Initializing "+appname+"-client-nautilus extension")
|
print("Initializing "+appname+"-client-nautilus extension")
|
||||||
|
|
||||||
|
|
||||||
def get_local_path(url):
|
def get_local_path(url):
|
||||||
if url[0:7] == 'file://':
|
if url[0:7] == 'file://':
|
||||||
url = url[7:]
|
url = url[7:]
|
||||||
return urllib.parse.unquote(url)
|
unquote = urllib.parse.unquote if python3 else urllib.unquote
|
||||||
|
return unquote(url)
|
||||||
|
|
||||||
def get_runtime_dir():
|
def get_runtime_dir():
|
||||||
"""Returns the value of $XDG_RUNTIME_DIR, a directory path.
|
"""Returns the value of $XDG_RUNTIME_DIR, a directory path.
|
||||||
|
|
Loading…
Reference in a new issue