Skip to content

Commit

Permalink
make contribs load when the working directory isn't swankr's
Browse files Browse the repository at this point in the history
depends on swank.R itself being source()d with chdir=TRUE, but doesn't
break any previously-working use case.
  • Loading branch information
csrhodes committed Aug 20, 2011
1 parent f678cda commit 85dd189
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion swank.R
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 85dd189

Please sign in to comment.