Skip to content

windows support #76

Open
Open
@pcerman

Description

@pcerman

Hi. I am mostly using your project on linux machines but I need to use it also on windows machine. Unfortunately there is problem with the naming files and folders. Any name in the windows file system does not allow to use character ':'. I have some idea how to use it on windows machine. Loading this file on start of chez scheme allows to map any not supported characters. It maps ':' symbol's character into "%3a" string in this example.

;;;
;;; define windows specific "library-search-handler"
;;;

(define restore-library-search-handler #f)
(define windows-library-search-handler #f)

(let ((*old-library-search-handler* #f))
  (define chars-map '((#\: #\% #\3 #\a)))

  (define (symbol-subst sym)
    (if (not (symbol? sym)) sym
        (let loop ((lst (string->list (symbol->string sym))) (new-lst '()) (changed #f))
          (if (null? lst)
              (if (not changed) sym
                  (string->symbol (list->string (reverse new-lst))))
              (let ((ap (assoc (car lst) chars-map)))
                (cond ((not ap)
                       (loop (cdr lst) (cons (car lst) new-lst) changed))
                      ((pair? (cdr ap))
                       (loop (cdr lst) (append (reverse (cdr ap)) new-lst) #t))
                      (else
                       (loop (cdr lst) (cons (cdr ap) new-lst) #t))))))))

  (define (wlsh who lib dir* ext*)
    (*old-library-search-handler* who (map symbol-subst lib) dir* ext*))

  (set! restore-library-search-handler
        (lambda ()
          (when *old-library-search-handler*
            (library-search-handler *old-library-search-handler*)
            (set! *old-library-search-handler* #f))))

  (set! windows-library-search-handler
        (lambda ()
          (when (not *old-library-search-handler*)
            (set! *old-library-search-handler* (library-search-handler))
            (library-search-handler wlsh))))

  (windows-library-search-handler))

Of course it requires to write the library installator for windows too. Maybe I have something overlooked and there is simpler way to use it on windows. This is only idea, not implementation. Any comment is welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions