OSDN Git Service

Correct paste problem with file name.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 12 Oct 2011 09:25:02 +0000 (05:25 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Wed, 12 Oct 2011 09:25:02 +0000 (05:25 -0400)
src/cx/fbn/nevernote/gui/BrowserWindow.java

index 8f0eef7..4ef8373 100644 (file)
@@ -2426,19 +2426,25 @@ public class BrowserWindow extends QWidget {
                QFile resourceFile; \r
                //These two lines are added to handle odd characters in the name like #.  Without it\r
                // toLocalFile() chokes and returns the wrong name.\r
-               url = url.replace("file:///", "");\r
-               url = url.replace("file://", "");\r
+               logger.log(logger.EXTREME, "File URL:" +url);\r
+               String whichOS = System.getProperty("os.name");\r
+               if (whichOS.contains("Windows")) \r
+                       url = url.replace("file:///", "");\r
+               else\r
+                       url = url.replace("file://", "");\r
                String urlTest = new QUrl(url).toLocalFile();\r
+               logger.log(logger.EXTREME, "File URL toLocalFile():" +urlTest);\r
                urlTest = url;\r
                if (!urlTest.equals(""))\r
                        url = urlTest;\r
 //             url = url.replace("/", File.separator);\r
-               logger.log(logger.EXTREME, "Reading from file to create resource");\r
+               logger.log(logger.EXTREME, "Reading from file to create resource:" +url);\r
                resourceFile = new QFile(url); \r
        resourceFile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly));\r
-//     logger.log(logger.EXTREME, "Error opening file "+url.toString()  +": "+resourceFile.errorString());\r
+       logger.log(logger.EXTREME, "Error opening file "+url.toString()  +": "+resourceFile.errorString());\r
        byte[] fileData = resourceFile.readAll().toByteArray();\r
        resourceFile.close();\r
+       logger.log(logger.EXTREME, "File Length: " +fileData.length);\r
        if (fileData.length == 0)\r
                return null;\r
        MessageDigest md;\r