designating a folder for shared libraries

designating a folder for shared libraries

Post by Olof Hellm » Thu, 18 Dec 1997 04:00:00



I have a stack of plug-ins for my application in a "plug-ins"
folder in the same folder as my application.  I can set set this
as the default folder for the shared library search algorithm
described in the Code Fragment Manager documentation
by creating an alias resource that points to the file
and setting the right alias ID in the cfrg resource.  OK so far.

The problem is, what happens when the user moves my application
to a different computer?  Now the alias points to the folder location
on the previous computer's disk.  I need to either: a) force Code Fragment
manager to  resolve the alias relative to my application file, or
b) make a new alias and stuff it into my application resource fork
if my app finds that said alias doesn't point to the right folder.

As I don't know how to do a), I'm currently using b), which is not
only breaking the rule about an application not modifying itself,
but it also forces the user to relaunch the application, bacause CFM has
already set the shared library search path.

Any ideas?  Am I doing something very silly?  Is there a way to build an alias
such that it can only be resolved relative to another file?

- Olof

 
 
 

designating a folder for shared libraries

Post by Loren Pea » Sun, 21 Dec 1997 04:00:00




>I have a stack of plug-ins for my application in a "plug-ins"
>folder in the same folder as my application.  I can set set this
>as the default folder for the shared library search algorithm
>described in the Code Fragment Manager documentation
>by creating an alias resource that points to the file
>and setting the right alias ID in the cfrg resource.  OK so far.

>The problem is, what happens when the user moves my application
>to a different computer?  Now the alias points to the folder location
>on the previous computer's disk.  I need to either: a) force Code Fragment
>manager to  resolve the alias relative to my application file, or
>b) make a new alias and stuff it into my application resource fork
>if my app finds that said alias doesn't point to the right folder.

>As I don't know how to do a), I'm currently using b), which is not
>only breaking the rule about an application not modifying itself,
>but it also forces the user to relaunch the application, bacause CFM has
>already set the shared library search path.

>Any ideas?  Am I doing something very silly?  Is there a way to build an alias
>such that it can only be resolved relative to another file?

>- Olof

It is pretty easy to make a relative alias, in the call to NewAlias, the first
argument is a FSSpec * which should be NULL for absolute aliases or a valid
spec if you wish to make a relative alias.  As I recall from when I had to
do the same thing; you call NewAlias with the first argument as a FSSpec
for your
application, and the second a FSSpec for you library/plugin folder.

Hope this helps.

Loren Peace


 
 
 

designating a folder for shared libraries

Post by Olof Hellm » Tue, 23 Dec 1997 04:00:00






>> <snip>

> It is pretty easy to make a relative alias, in the call to NewAlias, the first
> argument is a FSSpec * which should be NULL for absolute aliases or a valid
> spec if you wish to make a relative alias.  As I recall from when I had to
> do the same thing; you call NewAlias with the first argument as a FSSpec
> for your application, and the second a FSSpec for you library/plugin folder.

> Hope this helps.

> Loren Peace


This is exactly the problem.  If I do this, and then if the user copies
the application,
the alias in the copied app will be resolved relative to the original
application, and thus the
alias gets resolved to the plug-ins folders in the same folder as the original,
not the new copy.
 
 
 

1. Shared library folder location...

How can I determine, inside a running shared library, what my folder and
file name is?  I want to be able to know that I am running in "Desktop
Folder:MyApp:Shared" and my file name is "My Lib", for example. Also, is
there a function to return the System Extensions folder?  Is there more than
one Extensions folder?

Basically, I'd like to check to see if a user or has placed my Shared
Library into one of the system folders by accident (I only want our shared
library to live in the application's folder).

Thanks,

->Jeff

2. L2TP Connection

3. eyemodule, shared library call another shared library

4. Does anyone have Samba 1.9.16p2 running under Solaris 2.5?

5. Slow accessing file/folder in a folder with hundreds of folders/files

6. Lookinmg for Dungeon Master.

7. problem with exceptions, shared libraries and shared memory

8. Outlook express 2 user

9. Sharing Data Section and Shared Libraries

10. shared data initialization in shared libraries

11. Shared library vs. library

12. Import shared library from application's library directory

13. Library vs. Share Library