# Does DrRacket have a function that returns the Package Source path

**URL:** <https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229>\
**Category:** Questions & Answers\
**Created:** [November 22, 2021, 10:44pm UTC](https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229 "2021-11-22T22:44:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://racket.discourse.group/u/Don)\
**Post date:** [November 22, 2021, 10:44pm UTC](https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229/1 "2021-11-22T22:44:02Z")

</div>

A package source path can be entered in:  
DrRacket/Package Manager/Package Source:

Would be nice if there was a function that could return the entered value.  
The nearest similar function that I can find is: current-library-collection-paths

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [November 23, 2021, 1:09am UTC](https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229/2 "2021-11-23T01:09:39Z")

</div>

Sorry, I'm not understanding what you're looking for. What would this function take as an input, and what would it return?

Apologies if I'm a little slow.

---

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://racket.discourse.group/u/Don)\
**Post date:** [November 23, 2021, 6:50pm UTC](https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229/3 "2021-11-23T18:50:07Z")

</div>

Hi John,  
In reply to your question...  
In the same way that the racket function: current-library-collection-paths returns a list of paths that have been set elsewhere, not by the function: current-library-collection-paths,  
I suspect that there may already exist a function that can return the path I have manually set within DrRacket by selecting this series of menu options:  
/File/Package Manager/Package Source: ".plt-scheme/4.2.1/collects/DG/"  
Since I don't currently know of a function that can return the above string, I currently define a semi-global var to contain the same string and refer to that semi-global var in many of my modules. (No need for the semi-global var if I knew of a function that returned the same string.)

---

<div class="post-metadata">

**Author:** ![ryanc](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ryanc/32/71_2.png) [@ryanc](https://racket.discourse.group/u/ryanc)\
**Post date:** [November 23, 2021, 7:57pm UTC](https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229/4 "2021-11-23T19:57:14Z")

</div>

It sounds like you have _installed a package_, perhaps named "DG", and you want the path of the package's source directory. You can get that with [`pkg-directory`](https://docs.racket-lang.org/pkg/lib.html#%28def._%28%28lib._pkg%2Flib..rkt%29._pkg-directory%29%29), like `(pkg-directory "DG")`.

But that's usually not the best solution if you have Racket code that wants to refer to files relative to the enclosing module source file. A better solution is [`define-runtime-path`](https://docs.racket-lang.org/reference/Filesystem.html#%28form._%28%28lib._racket%2Fruntime-path..rkt%29._define-runtime-path%29%29) and the other forms in the `racket/runtime-path` library.

---

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://racket.discourse.group/u/Don)\
**Post date:** [November 24, 2021, 4:29pm UTC](https://racket.discourse.group/t/does-drracket-have-a-function-that-returns-the-package-source-path/229/5 "2021-11-24T16:29:31Z")

</div>

Hi Ryan,  
I did not install a package named "DG".  
My thanks for your pointers.  
After working through the suggestions, I have determined that none are the sought-after function.  
I am now writing a new query to help me transition to being able to use define-runtime-path and other forms in the racket/runtime-path library.
