Permalink
Browse files

make contribs load when the working directory isn't swankr's

depends on swank.R itself being source()d with chdir=TRUE, but doesn't
break any previously-working use case.
  • Loading branch information...
1 parent f678cda commit 85dd189db72b44284ac2da666c100d7c36c94d6e @csrhodes committed Aug 20, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 swank.R
View
@@ -13,6 +13,12 @@
### latest version of the GNU General Public Licence is available at
### <http://www.gnu.org/licenses/gpl.txt>.
+### KLUDGE: this assumes that we're being sourced with chdir=TRUE.
+### (If not, `swank:swank-require` will work under the circumstances
+### that it used to work anyway -- i.e. the working directory is the
+### swankr directory)
+swankrPath <- getwd()
+
swank <- function(port=4005) {
acceptConnections(port, FALSE)
}
@@ -288,7 +294,7 @@ printToString <- function(val) {
`swank:swank-require` <- function (slimeConnection, sldbState, contribs) {
for(contrib in contribs) {
- filename <- sprintf("%s.R", as.character(contrib))
+ filename <- sprintf("%s/%s.R", swankrPath, as.character(contrib))
if(file.exists(filename)) {
source(filename)
}

0 comments on commit 85dd189

Please sign in to comment.