Skip to content

Commit

Permalink
RunService: Fixed issue where files with spaces caused issues on wind…
Browse files Browse the repository at this point in the history
…ows - fixes #514

The issue this commit was originally trying to address needs to be fixed at a higher level.

Revert "Fixed an error in the Run service"

This reverts commit 03e692d84437518677e38729c4d1ff54306462a9.

(integrated from master branch change 9.2.1-214-gc57a733 by Nathan Rijksen <n.rijksen@gmail.com>)
  • Loading branch information
Naatan committed Aug 14, 2015
1 parent b8a73d8 commit 56ca478
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions src/run/koRunService.p.py
Expand Up @@ -228,24 +228,24 @@ def _getCodeMap(self, fileName=None, lineNum=None, word=None,
codeMap['node.js'] = codeMap["nodejs"]
from os.path import basename, dirname, splitext
if fileName is not None:
codeMap['b'] = self._treat_blanks(splitext(basename(fileName))[0])
codeMap['f'] = self._treat_blanks(basename(fileName))
codeMap['F'] = self._treat_blanks(fileName)
codeMap['d'] = self._treat_blanks(basename(dirname(fileName)))
codeMap['D'] = self._treat_blanks(dirname(fileName))
codeMap['b'] = splitext(basename(fileName))[0]
codeMap['f'] = basename(fileName)
codeMap['F'] = fileName
codeMap['d'] = basename(dirname(fileName))
codeMap['D'] = dirname(fileName)
if lineNum > 0:
codeMap['L'] = str(lineNum)
if word:
codeMap['w'] = word
codeMap['W'] = word
if projectFile:
codeMap['P'] = self._treat_blanks(projectFile)
codeMap['p'] = self._treat_blanks(dirname(projectFile))
codeMap['P'] = projectFile
codeMap['p'] = dirname(projectFile)
partSvc = components.classes["@activestate.com/koPartService;1"]\
.getService(components.interfaces.koIPartService)
project = partSvc.currentProject
if project:
codeMap['i'] = self._treat_blanks(project.liveDirectory)
codeMap['i'] = project.liveDirectory
if selection:
codeMap['w'] = selection
codeMap['s'] = selection
Expand Down Expand Up @@ -737,21 +737,8 @@ def GetBlockOffsets(self, s, bracketed):

#print "GetBlockOffsets(s=%r): %r" % (s, offsets)
return offsets

def _treat_blanks(self, fl):
"""Treats the file path
to make it executable
:param fl: the file path string"""

treated_file_dir = ''

if os.name == 'nt':
treated_file_dir = '"'+fl+'"'
else:
for part in fl.split(" ")[:-1]: treated_file_dir += part + "\ "
treated_file_dir += fl.split(" ")[-1]

return treated_file_dir


class KoRunService:
_com_interfaces_ = components.interfaces.koIRunService
Expand Down

0 comments on commit 56ca478

Please sign in to comment.