{"id":534,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=534"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"the-right-way-to-find-system-paths","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=534","title":{"rendered":"The\n right way to find system paths"},"content":{"rendered":"<p>Because BeOS may one day go multi-user, and because it&#8217;s possible for users to hack BeOS into custom configurations, and for a variety of other reasons, it&#8217;s a bad idea to hard-code system paths such as <code>\/boot\/home<\/code> or <code>\/boot\/beos\/bin<\/code>. BeOS provides a mechanism that will identify the proper directory for any given purpose. These directories are stored in the Storage Kit, and can be located from the shell with the finddir command.<br \/>\nYou&#8217;ll find a complete list of &#8222;magic names&#8220; in the <a href=\"http:\/\/www-classic.be.com\/documentation\/be_book\/The%20Storage%20Kit\/misc. html\">Global Constants and Defined Types<\/a> section of the BeBook (see the &#8222;Directories&#8220; section). For example, one of the defined names is &#8222;B_BEOS_SYSTEM_DIRECTORY&#8220;. If you open a Terminal and type:<\/p>\n<pre>finddir B_BEOS_SYSTEM_DIRECTORY<\/pre>\n<p>the shell returns:<\/p>\n<pre>\/boot\/beos\/system<\/pre>\n<p>If you type:<\/p>\n<pre>finddir B_COMMON_ADDONS_DIRECTORY<\/pre>\n<p>the shell returns:<\/p>\n<pre>\/boot\/home\/config\/add-ons<\/pre>\n<p>and so on. So the right way to find the user&#8217;s home directory from within a script would be something like:<\/p>\n<pre>UserHome=$(finddir B_USER_DIRECTORY)<\/pre>\n<p>The value of $UserHome on most systems will then be <code>\/boot\/home<\/code>, but the script won&#8217;t break in the future if things move around.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because BeOS may one day go multi-user, and because it&#8217;s possible for users to hack BeOS into custom configurations, and for a variety of other reasons, it&#8217;s a bad idea to hard-code system paths such as \/boot\/home or \/boot\/beos\/bin. BeOS provides a mechanism that will identify the proper directory for any given purpose. These directories [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[10],"class_list":["post-534","post","type-post","status-publish","format-standard","hentry","tag-scripting"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=534"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/534\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}