Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
8234966a
Commit
8234966a
authored
Oct 03, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
if https:// GET fails, report the URL
parent
44ca3530
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
22 deletions
+34
-22
richio.h
include/richio.h
+11
-13
github_plugin.cpp
pcbnew/github/github_plugin.cpp
+23
-9
No files found.
include/richio.h
View file @
8234966a
...
@@ -115,31 +115,29 @@ struct IO_ERROR // : std::exception
...
@@ -115,31 +115,29 @@ struct IO_ERROR // : std::exception
* @param aMsg is error text that will be streamed through wxString.Printf()
* @param aMsg is error text that will be streamed through wxString.Printf()
* using the format string IO_FORMAT above.
* using the format string IO_FORMAT above.
*/
*/
IO_ERROR
(
const
char
*
aThrowersFile
,
explicit
IO_ERROR
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
char
*
aThrowersLoc
,
const
wxString
&
aMsg
)
const
wxString
&
aMsg
)
{
{
init
(
aThrowersFile
,
aThrowersLoc
,
aMsg
);
init
(
aThrowersFile
,
aThrowersLoc
,
aMsg
);
}
}
#if !wxCHECK_VERSION(2, 9, 0)
explicit
IO_ERROR
(
const
char
*
aThrowersFile
,
// 2.9.0 and greater provide a wxString() constructor taking "const char*" whereas
// 2.8 did not. In 2.9.x this IO_ERROR() constructor uses that wxString( const char* )
// constructor making this here constructor ambiguous with the IO_ERROR()
// taking the wxString.
IO_ERROR
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
char
*
aThrowersLoc
,
const
std
::
string
&
aMsg
)
const
std
::
string
&
aMsg
)
{
{
init
(
aThrowersFile
,
aThrowersLoc
,
wxString
::
FromUTF8
(
aMsg
.
c_str
()
)
);
init
(
aThrowersFile
,
aThrowersLoc
,
wxString
::
FromUTF8
(
aMsg
.
c_str
()
)
);
}
}
#endif
/**
explicit
IO_ERROR
(
const
char
*
aThrowersFile
,
* handles the case where _() is passed as aMsg.
const
char
*
aThrowersLoc
,
*/
const
char
*
aMsg
)
IO_ERROR
(
const
char
*
aThrowersFile
,
{
init
(
aThrowersFile
,
aThrowersLoc
,
wxString
::
FromUTF8
(
aMsg
)
);
}
/// handle the case where _() is passed as aMsg.
explicit
IO_ERROR
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
char
*
aThrowersLoc
,
const
wxChar
*
aMsg
)
const
wxChar
*
aMsg
)
{
{
...
...
pcbnew/github/github_plugin.cpp
View file @
8234966a
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
using
namespace
std
;
using
namespace
std
;
typedef
boost
::
ptr_map
<
st
d
::
string
,
wxZipEntry
>
MODULE_MAP
;
typedef
boost
::
ptr_map
<
st
ring
,
wxZipEntry
>
MODULE_MAP
;
typedef
MODULE_MAP
::
iterator
MODULE_ITER
;
typedef
MODULE_MAP
::
iterator
MODULE_ITER
;
typedef
MODULE_MAP
::
const_iterator
MODULE_CITER
;
typedef
MODULE_MAP
::
const_iterator
MODULE_CITER
;
...
@@ -166,11 +166,17 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath ) throw( IO_ERROR )
...
@@ -166,11 +166,17 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath ) throw( IO_ERROR )
{
{
if
(
!
m_cache
||
m_lib_path
!=
aLibraryPath
)
if
(
!
m_cache
||
m_lib_path
!=
aLibraryPath
)
{
{
//D(printf("%s: this:%p m_lib_path:'%s' aLibraryPath:'%s'\n", __func__, this, TO_UTF8( m_lib_path), TO_UTF8(aLibraryPath) );)
// operator==( wxString, wxChar* ) does not exist, construct wxString once here.
const
wxString
kicad_mod
(
wxT
(
"kicad_mod"
)
);
//D(printf("%s: this:%p m_lib_path:'%s' aLibraryPath:'%s'\n", __func__, this, TO_UTF8( m_lib_path), TO_UTF8(aLibraryPath) );)
delete
m_cache
;
delete
m_cache
;
m_cache
=
new
GH_CACHE
();
m_cache
=
new
GH_CACHE
();
// INIT_LOGGER( "/tmp", "test.log" );
remote_get_zip
(
aLibraryPath
);
remote_get_zip
(
aLibraryPath
);
// UNINIT_LOGGER();
m_lib_path
=
aLibraryPath
;
m_lib_path
=
aLibraryPath
;
wxMemoryInputStream
mis
(
&
m_zip_image
[
0
],
m_zip_image
.
size
()
);
wxMemoryInputStream
mis
(
&
m_zip_image
[
0
],
m_zip_image
.
size
()
);
...
@@ -182,11 +188,11 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath ) throw( IO_ERROR )
...
@@ -182,11 +188,11 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath ) throw( IO_ERROR )
while
(
(
entry
=
zis
.
GetNextEntry
()
)
!=
NULL
)
while
(
(
entry
=
zis
.
GetNextEntry
()
)
!=
NULL
)
{
{
wxFileName
fn
(
entry
->
GetName
()
);
wxFileName
fn
(
entry
->
GetName
()
);
// chop long name into parts
if
(
fn
.
GetExt
()
==
wxT
(
"kicad_mod"
)
)
if
(
fn
.
GetExt
()
==
kicad_mod
)
{
{
string
fp_name
=
TO_UTF8
(
fn
.
GetName
()
);
string
fp_name
=
TO_UTF8
(
fn
.
GetName
()
);
// omit extension & path
m_cache
->
insert
(
fp_name
,
entry
);
m_cache
->
insert
(
fp_name
,
entry
);
}
}
...
@@ -253,9 +259,17 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR )
...
@@ -253,9 +259,17 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR )
// 4 lines, using SSL, top that.
// 4 lines, using SSL, top that.
}
}
catch
(
std
::
exception
&
e
)
catch
(
boost
::
system
::
system_error
&
e
)
{
{
THROW_IO_ERROR
(
e
.
what
()
);
// https "GET" has faild, report this to API caller.
wxString
fmt
(
_
(
"Cannot GET zip: '%s'
\n
for lib-path: '%s'.
\n
What: '%s'"
)
);
string
msg
=
StrPrintf
(
TO_UTF8
(
fmt
),
zip_url
.
c_str
(),
TO_UTF8
(
aRepoURL
),
e
.
what
()
);
THROW_IO_ERROR
(
msg
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment