[hdf-compass] 93/295: Fix to consistently manage URI on Windows

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.

commit 3f2e845dc31afd0ff9555df094312211649ff21c
Author: giumas <giumas at yahoo.it>
Date:   Sun Sep 27 22:28:14 2015 -0400

    Fix to consistently manage URI on Windows
---
 asc_model/__init__.py      | 7 +++++--
 compass_viewer/__init__.py | 5 ++++-
 compass_viewer/frame.py    | 6 +++++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/asc_model/__init__.py b/asc_model/__init__.py
index 321a409..8262efd 100644
--- a/asc_model/__init__.py
+++ b/asc_model/__init__.py
@@ -18,7 +18,7 @@ See: http://en.wikipedia.org/wiki/Esri_grid for a description of
 the file format
 """
 
-import os
+import sys
 import os.path as op
 import numpy as np
 import linecache
@@ -76,7 +76,10 @@ class AsciiGrid(compass_model.Store):
         return None
 
     def getFilePath(self):
-        prefixLen = len('file://')
+        if sys.platform == 'win32':
+            prefixLen = len('file:///')
+        else:
+            prefixLen = len('file://')
         return self._url[prefixLen:]
 
 class ASCFile(compass_model.Array):
diff --git a/compass_viewer/__init__.py b/compass_viewer/__init__.py
index 6c292df..7f1d143 100644
--- a/compass_viewer/__init__.py
+++ b/compass_viewer/__init__.py
@@ -170,7 +170,10 @@ def run():
     for url in sys.argv[1:]:
         if "://" not in url:
             # assumed to be file path
-            url = 'file://'+op.abspath(url)
+            if sys.platform == 'win32':
+                url = 'file:///'+op.abspath(url)
+            else:
+                url = 'file://'+op.abspath(url)
         if not open_store(url):
             print 'Failed to open "%s"; no handlers'%url
 
diff --git a/compass_viewer/frame.py b/compass_viewer/frame.py
index 9a6ac57..4dffa5e 100644
--- a/compass_viewer/frame.py
+++ b/compass_viewer/frame.py
@@ -18,6 +18,7 @@ Much of the common functionality (e.g. "Open File..." menu item) is implemented
 here.
 """
 
+import sys
 import wx
 from wx.lib.pubsub import pub
 
@@ -135,7 +136,10 @@ class BaseFrame(wx.Frame):
         if dlg.ShowModal() != wx.ID_OK:
             return
         path = dlg.GetPath()
-        url = 'file://'+path
+        if sys.platform == 'win32':
+            url = 'file:///' + path
+        else:
+            url = 'file://' + path
         if not open_store(url):
             dlg = wx.MessageDialog(self, 'The following file could not be opened:\n\n%s' % path,
                                'No handler for file', wx.OK | wx.ICON_INFORMATION)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git



More information about the debian-science-commits mailing list