kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28007
Re: cross-platform filename fun
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
jp charras <jp.charras@xxxxxxxxxx>
-
Date:
Tue, 21 Feb 2017 12:52:03 +0100
-
In-reply-to:
<CAHBNN+MmSZUt74YmvLMfk0z0NvxoEZfKOhBvH=DkS9WMgtwNZA@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
Le 21/02/2017 à 09:02, Cirilo Bernardo a écrit :
> Hi folks,
>
> A number of STEP related bugs have been reported and at this point in
> time I suspect the problems have something to do with character
> translations.
>
> Bug 1: On Windows, STEP files with non-ASCII characters in the path
> are not correctly processed by the 3D plugin. In this case all code is
> running within one process and I believe I have a fix.
>
> Bug 2: On Windows files with the extension "STEP" don't seem to load.
> I'm not sure what's going on here yet; I need to read up on a few
> wx widgets.
>
> Bug 3: Well, no one has reported such a bug yet, but the underlying
> problem with Bug 1 should also affect the external kicad2step tool,
> but only on Windows.
>
> Has anyone observed such bugs and have anything to add?
>
> - Cirilo
Hi Cirilo,
I am thinking there are 2 bugs, not only one in plugins code.
The first is related to the way the extensions are analyzed in the code.
The code consider only the ext in lower case on Windows. I am suspecting there are somewhere case
sensitive comparisons in code.
Just consider Windows platform and Unix platforms are the same to fix this issue (attached a short
patch just as proof of this assertion).
The code will be simpler and more reliable.
It has also the advantage to be the same (showing the same dialogs and same messages) on all platforms.
The second is related to non ASCII filenames.
This is a different bug, not fixed by my short patch.
Thanks.
--
Jean-Pierre CHARRAS
plugins/3d/idf/s3d_plugin_idf.cpp | 27 +++++++--------------------
plugins/3d/oce/oce.cpp | 17 +++--------------
plugins/3d/vrml/vrml.cpp | 16 ++--------------
3 files changed, 12 insertions(+), 48 deletions(-)
diff --git a/plugins/3d/idf/s3d_plugin_idf.cpp b/plugins/3d/idf/s3d_plugin_idf.cpp
index 53ed487..614da1b 100644
--- a/plugins/3d/idf/s3d_plugin_idf.cpp
+++ b/plugins/3d/idf/s3d_plugin_idf.cpp
@@ -195,27 +195,17 @@ void GetPluginVersion( unsigned char* Major,
}
// number of extensions supported
-#ifdef _WIN32
- #define NEXTS 2
-#else
- #define NEXTS 4
-#endif
+#define NEXTS 4
// number of filter sets supported
#define NFILS 2
static char ext0[] = "idf";
static char ext1[] = "emn";
-
-#ifdef _WIN32
- static char fil0[] = "IDF (*.idf)|*.idf";
- static char fil1[] = "IDF BRD v2/v3 (*.emn)|*.emn";
-#else
- static char ext2[] = "IDF";
- static char ext3[] = "EMN";
- static char fil0[] = "IDF (*.idf;*.IDF)|*.idf;*.IDF";
- static char fil1[] = "IDF BRD (*.emn;*.EMN)|*.emn;*.EMN";
-#endif
+static char ext2[] = "IDF";
+static char ext3[] = "EMN";
+static char fil0[] = "IDF (*.idf;*.IDF)|*.idf;*.IDF";
+static char fil1[] = "IDF BRD (*.emn;*.EMN)|*.emn;*.EMN";
static struct FILE_DATA
{
@@ -226,13 +216,10 @@ static struct FILE_DATA
{
extensions[0] = ext0;
extensions[1] = ext1;
- filters[0] = fil0;
- filters[1] = fil1;
-
-#ifndef _WIN32
extensions[2] = ext2;
extensions[3] = ext3;
-#endif
+ filters[0] = fil0;
+ filters[1] = fil1;
return;
}
diff --git a/plugins/3d/oce/oce.cpp b/plugins/3d/oce/oce.cpp
index 62f6e82..2ec4538 100644
--- a/plugins/3d/oce/oce.cpp
+++ b/plugins/3d/oce/oce.cpp
@@ -63,11 +63,7 @@ void GetPluginVersion( unsigned char* Major,
}
// number of extensions supported
-#ifdef _WIN32
-#define NEXTS 4
-#else
#define NEXTS 8
-#endif
// number of filter sets supported
#define NFILS 2
@@ -77,17 +73,12 @@ static char ext1[] = "step";
static char ext2[] = "igs";
static char ext3[] = "iges";
-#ifdef _WIN32
-static char fil0[] = "STEP (*.stp;*.step)|*.stp;*.step";
-static char fil1[] = "IGES (*.igs;*.iges)|*.igs;*.iges";
-#else
static char ext4[] = "STP";
static char ext5[] = "STEP";
static char ext6[] = "IGS";
static char ext7[] = "IGES";
static char fil0[] = "STEP (*.stp;*.STP;*.step;*.STEP)|*.stp;*.STP;*.step;*.STEP";
static char fil1[] = "IGES (*.igs;*.IGS;*.iges;*.IGES)|*.igs;*.IGS;*.iges;*.IGES";
-#endif
static struct FILE_DATA
{
@@ -100,15 +91,13 @@ static struct FILE_DATA
extensions[1] = ext1;
extensions[2] = ext2;
extensions[3] = ext3;
- filters[0] = fil0;
- filters[1] = fil1;
-
-#ifndef _WIN32
extensions[4] = ext4;
extensions[5] = ext5;
extensions[6] = ext6;
extensions[7] = ext7;
-#endif
+
+ filters[0] = fil0;
+ filters[1] = fil1;
return;
}
diff --git a/plugins/3d/vrml/vrml.cpp b/plugins/3d/vrml/vrml.cpp
index c2e2ab5..b78009a 100644
--- a/plugins/3d/vrml/vrml.cpp
+++ b/plugins/3d/vrml/vrml.cpp
@@ -74,11 +74,7 @@ void GetPluginVersion( unsigned char* Major,
}
// number of extensions supported
-#ifdef _WIN32
-#define NEXTS 2
-#else
#define NEXTS 4
-#endif
// number of filter sets supported
#define NFILS 2
@@ -86,15 +82,10 @@ void GetPluginVersion( unsigned char* Major,
static char ext0[] = "wrl";
static char ext1[] = "x3d";
-#ifdef _WIN32
-static char fil0[] = "VRML 1.0/2.0 (*.wrl)|*.wrl";
-static char fil1[] = "X3D (*.x3d)|*.x3d";
-#else
static char ext2[] = "WRL";
static char ext3[] = "X3D";
static char fil0[] = "VRML 1.0/2.0 (*.wrl;*.WRL)|*.wrl;*.WRL";
static char fil1[] = "X3D (*.x3d;*.X3D)|*.x3d;*.X3D";
-#endif
static struct FILE_DATA
{
@@ -105,13 +96,10 @@ static struct FILE_DATA
{
extensions[0] = ext0;
extensions[1] = ext1;
- filters[0] = fil0;
- filters[1] = fil1;
-
-#ifndef _WIN32
extensions[2] = ext2;
extensions[3] = ext3;
-#endif
+ filters[0] = fil0;
+ filters[1] = fil1;
return;
}
Follow ups
References