Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Albert Gräf
Gem
Commits
c027bfea
Commit
c027bfea
authored
Aug 26, 2017
by
IOhannes m zmölnig
Browse files
added RTE::addSearchPath()
parent
30a451d8
Changes
2
Show whitespace changes
Inline
Side-by-side
src/RTE/RTE.cpp
View file @
c027bfea
...
@@ -14,13 +14,22 @@
...
@@ -14,13 +14,22 @@
// currently only numeric arrays
// currently only numeric arrays
//
//
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
#include "Gem/GemConfig.h"
#include "RTE/RTE.h"
#include "RTE/RTE.h"
#include "m_pd.h"
#include "m_pd.h"
#include <sstream>
#if defined HAVE_S_STUFF_H
extern
"C"
{
# include "s_stuff.h"
}
#else
# warning s_stuff.h missing
#endif
#include <sstream>
#if defined __linux__ || defined __APPLE__
#if defined __linux__ || defined __APPLE__
# define DL_OPEN
# define DL_OPEN
#endif
#endif
...
@@ -141,3 +150,40 @@ std::string RTE::findFile(const std::string&f, const std::string&e, const void*
...
@@ -141,3 +150,40 @@ std::string RTE::findFile(const std::string&f, const std::string&e, const void*
}
}
return
result
;
return
result
;
}
}
bool
RTE
::
addSearchPath
(
const
std
::
string
&
path
,
void
*
ctx
)
{
static
bool
didit
=
false
;
static
t_namelist
*
rte_searchpath
=
0
;
static
bool
modern
=
true
;
if
(
ctx
)
return
false
;
if
(
!
didit
)
{
unsigned
int
major
=
0
,
minor
=
0
;
rte_searchpath
=
(
t_namelist
*
)
this
->
getFunction
(
"sys_searchpath"
);
this
->
getVersion
(
major
,
minor
);
modern
=
((
major
>
0
)
||
(
minor
>
47
));
}
if
(
modern
)
{
t_atom
ap
[
2
];
const
char
*
inptr
=
path
.
c_str
();
char
encoded
[
MAXPDSTRING
];
char
*
outptr
=
encoded
;
*
outptr
++=
'+'
;
while
(
inptr
&&
((
outptr
+
2
)
<
(
encoded
+
MAXPDSTRING
)))
{
*
outptr
++
=
*
inptr
++
;
if
(
'+'
==
inptr
[
-
1
])
*
outptr
++=
'+'
;
}
*
outptr
=
0
;
SETSYMBOL
(
ap
+
0
,
gensym
(
encoded
));
SETFLOAT
(
ap
+
1
,
0.
f
);
pd_typedmess
(
gensym
(
"pd"
)
->
s_thing
,
gensym
(
"add-to-path"
),
2
,
ap
);
}
else
{
if
(
!
rte_searchpath
)
return
false
;
rte_searchpath
=
namelist_append
(
rte_searchpath
,
path
.
c_str
(),
0
);
}
return
true
;
}
src/RTE/RTE.h
View file @
c027bfea
...
@@ -50,6 +50,12 @@ namespace gem {
...
@@ -50,6 +50,12 @@ namespace gem {
* @return expanded filename
* @return expanded filename
*/
*/
virtual
std
::
string
findFile
(
const
std
::
string
&
name
,
const
std
::
string
&
ext
,
const
void
*
context
)
const
;
virtual
std
::
string
findFile
(
const
std
::
string
&
name
,
const
std
::
string
&
ext
,
const
void
*
context
)
const
;
/**
* add 'path' to the search-paths (if context==NULL, to the global search path)
* @return expanded filename
*/
virtual
bool
addSearchPath
(
const
std
::
string
&
path
,
void
*
context
);
};
};
};
};
};
};
...
...
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