Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Windows improvements.

  • Loading branch information...
commit 9be6af565d20fa5501c3d997eaa60a3e95a83ef1 1 parent 09274b7
@Amrykid Amrykid authored
Showing with 25 additions and 7 deletions.
  1. +3 −1 .gitignore
  2. +2 −2 aporia.nim
  3. +4 −0 cfg.nim
  4. +3 −3 suggest.nim
  5. +13 −1 utils.nim
View
4 .gitignore
@@ -1,2 +1,4 @@
nimcache
-aporia
+aporia
+*.exe
+*.dll
View
4 aporia.nim
@@ -14,7 +14,6 @@ import tables, algorithm
# Local imports:
import settings, utils, cfg, search, suggest, AboutDialog, processes,
CustomStatusBar
-
{.push callConv:cdecl.}
const
@@ -1047,7 +1046,7 @@ proc pl_Toggled(menuitem: PCheckMenuItem, id: cstring) =
proc GetCmd(cmd, filename: string): string =
var f = quoteIfContainsWhite(filename)
if cmd =~ peg"\s* '$' y'findExe' '(' {[^)]+} ')' {.*}":
- var exe = quoteIfContainsWhite(findExe(matches[0]))
+ var exe = quoteIfContainsWhite(getNimrodPath(win))
if exe.len == 0: exe = matches[0]
result = exe & " " & matches[1] % f
else:
@@ -1095,6 +1094,7 @@ proc compileRun(filename: string, shouldRun: bool) =
showBottomPanel()
var cmd = GetCmd(win.settings.nimrodCmd, filename)
+
# Execute the compiled application if compiled successfully.
# ifSuccess is the filename of the compiled app.
var runAfter: PExecOptions = nil
View
4 cfg.nim
@@ -36,6 +36,7 @@ proc defaultSettings*(): TSettings =
result.singleInstancePort = 55679
result.showCloseOnAllTabs = false
result.compileUnsavedSave = true
+ result.nimrodPath = ""
proc writeSection(f: TFile, sectionName: string) =
f.write("[")
@@ -95,6 +96,7 @@ proc save*(win: var MainWin) =
f.writeKeyVal("searchHighlightAll", $settings.searchHighlightAll)
f.writeKeyVal("singleInstancePort", $int(settings.singleInstancePort))
f.writeKeyVal("compileUnsavedSave", $settings.compileUnsavedSave)
+ f.writeKeyValRaw("nimrodpath", $settings.nimrodPath)
f.writeSection("auto")
f.write("; Stuff which is saved automatically," &
@@ -194,6 +196,8 @@ proc load*(input: PStream, lastSession: var seq[string]): TSettings =
result.lastSelectedTab = e.value
of "compileunsavedsave":
result.compileUnsavedSave = isTrue(e.value)
+ of "nimrodpath":
+ result.nimrodPath = e.value
else:
raise newException(ECFGParse, "Key \"" & e.key & "\" is invalid.")
of cfgError:
View
6 suggest.nim
@@ -1,4 +1,4 @@
-#
+#
#
# Aporia - Nimrod IDE
# (c) Copyright 2011 Dominik Picheta
@@ -167,7 +167,7 @@ proc filterSuggest*(win: var MainWin) =
proc asyncGetSuggest(win: var MainWin, file, projectFile, addToPath: string,
line, column: int) =
- let sugCmd = findExe("nimrod") &
+ let sugCmd = getNimrodPath(win) &
" idetools --path:$4 --track:$1,$2,$3 --suggest $5" %
[file, $(line+1), $column, addToPath,
if projectFile != "": projectFile else: file]
@@ -309,7 +309,7 @@ proc asyncGetDef*(win: var MainWin, file: string,
line, column: int,
onSugLine: proc (win: var MainWin, opts: PExecOptions, line: string) {.closure.},
onSugExit: proc (win: var MainWin, opts: PExecOptions, exitCode: int) {.closure.}): string =
- let sugCmd = findExe("nimrod") &
+ let sugCmd = getNimrodPath(win) &
" idetools --path:$4 --track:$1,$2,$3 --def $1" %
[file, $(line+1), $column, getTempDir()]
View
14 utils.nim
@@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#
-import gtk2, gtksourceview, glib2, osproc, streams, AboutDialog, asyncio, strutils
+import gtk2, gtksourceview, glib2, osproc, streams, AboutDialog, asyncio, strutils, dialogs
import tables, os
from CustomStatusBar import PCustomStatusBar, TStatusID
@@ -49,6 +49,8 @@ type
singleInstancePort*: int32 # Port used for listening socket to get filepaths
showCloseOnAllTabs*: bool # Whether to show a close btn on all tabs.
lastSelectedTab*: string # The tab filename that was selected when aporia was last closed.
+
+ nimrodPath*: string
MainWin* = object
# Widgets
@@ -468,3 +470,13 @@ proc findProjectFile*(directory: string): tuple[projectFile, projectCfg: string]
proc isTemporary*(t: Tab): bool =
## Determines whether ``t`` is saved in /tmp
return t.filename.startsWith(getTempDir())
+
+proc getNimrodPath*(win: var MainWin): string =
+ if win.settings.nimrodPath == "":
+ win.settings.nimrodPath = findExe("nimrod")
+
+ if win.settings.nimrodPath == "":
+ dialogs.info(win.w, "Unable to find nimrod executable. Please select it to continue.")
+ win.settings.nimrodPath = ChooseFileToOpen(win.w, "")
+
+ result = win.settings.nimrodPath
Please sign in to comment.
Something went wrong with that request. Please try again.