feat: specify tmp dir for images

This commit is contained in:
Richard Ramos 2020-07-21 11:30:09 -04:00 committed by RichΛrd
parent e557c6118f
commit 2f26af684a
2 changed files with 6 additions and 3 deletions

View File

@ -10,6 +10,8 @@ template debugMsg(typeName: string, procName: string) =
message &= procName
debugMsg(message)
import os
include "nimqml/private/dotherside.nim"
include "nimqml/private/nimqmltypes.nim"
include "nimqml/private/qmetaobject.nim"
@ -37,5 +39,6 @@ proc signal_handler*(receiver: pointer, signal: cstring, slot: cstring) =
if(dosqobj.isNil == false):
dos_signal(receiver, signal, slot)
proc image_resizer*(imagePath: string, maxSize: int = 2000): string =
result = $dos_image_resizer(imagePath.cstring, maxSize.cint)
proc image_resizer*(imagePath: string, maxSize: int = 2000, tmpDir: string): string =
discard existsOrCreateDir(tmpDir)
result = $dos_image_resizer(imagePath.cstring, maxSize.cint, tmpDir)

View File

@ -303,4 +303,4 @@ proc dos_qabstracttablemodel_create(modelPtr: NimQAbstractTableModel,
proc dos_qabstracttablemodel_parent(modelPtr: DosQAbstractTableModel, index: DosQModelIndex): DosQModelIndex {.cdecl, dynlib: dynLibName, importc.}
proc dos_qabstracttablemodel_index(modelPtr: DosQAbstractTableModel, row: cint, column: cint, parent: DosQModelIndex): DosQModelIndex {.cdecl, dynlib: dynLibName, importc.}
proc dos_image_resizer(imagePath: cstring, maxSize: cint): cstring {.cdecl, dynlib: dynLibName, importc.}
proc dos_image_resizer(imagePath: cstring, maxSize: cint, tmpDirPath: cstring): cstring {.cdecl, dynlib: dynLibName, importc.}