2015-06-26 01:36:36 +01:00
|
|
|
#!/usr/bin/python2
|
2009-07-27 11:45:34 +01:00
|
|
|
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import urllib
|
|
|
|
|
|
|
|
def GetFilePath(uri):
|
2016-05-21 17:11:36 +01:00
|
|
|
path = urllib.url2pathname(uri) # escape special chars
|
|
|
|
path = path.strip('\r\n\x00') # remove \r\n and NULL
|
2009-07-27 11:45:34 +01:00
|
|
|
|
2016-05-21 17:11:36 +01:00
|
|
|
# get the path to file
|
|
|
|
if path.startswith('file://'): # nautilus, rox
|
|
|
|
path = path[7:] # 7 is len('file://')
|
|
|
|
return path
|