From 5d37cb79e77c4e1bd47b54bab82922afdc87c060 Mon Sep 17 00:00:00 2001 From: Jacob Matthews Date: Thu, 7 Sep 2006 03:13:31 +0000 Subject: [PATCH] Added resolve-planet-path to util.ss svn: r4265 --- collects/planet/doc.txt | 7 +++++++ collects/planet/resolver.ss | 10 +++++++++- collects/planet/util.ss | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/collects/planet/doc.txt b/collects/planet/doc.txt index 1be93a4b28..9e8e270871 100644 --- a/collects/planet/doc.txt +++ b/collects/planet/doc.txt @@ -196,6 +196,13 @@ first removes the old link and then adds the new one. Removes any hard link that may be associated with the given package. +> (resolve-planet-path quoted-planet-require-spec) -> path + +Returns the file system path to the file specified by the given quoted +planet require specification. This function downloads and installs the +specified package if necessary, but does not verify that the actual +file within it actually exists. + _The PLaneT search order_ ------------------------- diff --git a/collects/planet/resolver.ss b/collects/planet/resolver.ss index 1bbfc245b8..8bea6afcb5 100644 --- a/collects/planet/resolver.ss +++ b/collects/planet/resolver.ss @@ -160,6 +160,7 @@ an appropriate subdirectory. "private/linkage.ss") (provide (rename resolver planet-module-name-resolver) + resolve-planet-path pkg-spec->full-pkg-spec get-package-from-cache get-package-from-server @@ -277,9 +278,16 @@ attempted to load version ~a.~a while version ~a.~a was already loaded" ; environment (define (planet-resolve spec module-path stx load?) (let-values ([(path pkg) (get-planet-module-path/pkg spec module-path stx)]) - (add-pkg-to-diamond-registry! pkg) + (when load? (add-pkg-to-diamond-registry! pkg)) (do-require path (pkg-path pkg) module-path stx load?))) + ;; resolve-planet-path : planet-require-spec -> path + ;; retrieves the path to the given file in the planet package. downloads and installs + ;; the package if necessary + (define (resolve-planet-path spec) + (let-values ([(path pkg) (get-planet-module-path/pkg spec #f #f)]) + path)) + ;; get-planet-module-path/pkg :PLANET-REQUEST symbol syntax[PLANET-REQUEST] -> path PKG ;; returns the matching package and the file path to the specific request (define (get-planet-module-path/pkg spec module-path stx) diff --git a/collects/planet/util.ss b/collects/planet/util.ss index 7b928c7fd6..38a55b9a79 100644 --- a/collects/planet/util.ss +++ b/collects/planet/util.ss @@ -23,7 +23,9 @@ get-installed-planet-archives get-hard-linked-packages remove-pkg - unlink-all) + unlink-all + + resolve-planet-path) (provide/contract [download/install-pkg