Paths in Projects
I have a project with some sound files that need to be loaded into a [umenu] when it launches. The sound files are copied locally into the project's media folder. To make the list, I am sending a message with the absolute path to [folder] with [loadmess]. When I create a standalone and use it on another machine it appears the files are not being found, presumably because that absolute path is no longer valid.
How do paths work in projects? I assume they have to be relative to the root level of the project somehow?
Thanks,
Brian
iirc project paths follow a standard Unix convention: they can be fully-specified as in:
/root/hd/projects
or relative:
../../projects
Watch out for conflicts with Max Preference and Patcher path settings.
Cheers
I guess the question is: How do I address a folder of files within the project in such a way that when I build a standalone, it still works?
For example, if I want a list of files in the project's Media folder, I send the absolute path to [folder]. What path do I send it if those files are included in the standalone?
You can place the files in project subdirectory referenced by:
/subdirectory/file1,
etc.
It will be recreated in the standalone. Avoid absolute paths.
Hmm...not working for me inside the project. I have a folder in the project called "media", and sending "/media" (or its variants) to [folder] gives me a 'not a folder' error in the Max window. Am I understanding correctly?
Activate "Search for missing files" in standalone object inspector.
place audio folder directly into resources folder of standalone.
That way you can do simple path stuff,
If deeper nested folder hierarchy is needed absolute path is your better choice.
Get path to patch while patching in max, or path to Standalone when compiled
and combine absolute path with folder hierarchy
like
sprintf symout %sMedia/Audio or
sprintf symout %sMedia/Video/Part-1
why not autopopulate umenu ?
+1 autopopulate
Maybe I should doublecheck my comment on the absolute path (?)
I am not used to all this new stuff as projects etc .
I anyway made own "projects" by placing all
patches, bpatchers, etc in one folder which then serves as search path for the main patch.
Even thought stuff can be found in search path, search is a search.
Absolute path needs not to search for anything, it knows exactly where object to load is.
In any case if one works with subfolders, like to drop main Media folder on dropfile
and then load files from subfolders into different objects, one has to use absolute path, or ?
a standalone is a max runtime, where every path relative to it (i.e. beside or below the executable) is the default search path.
for patchers you can also use [thispatcher] to find out the path of any patcher file and then construct a relative path to other documents.
option 3 is to use a preferences file. for 3 gb of sound content it is not best practice to force the user to install into a specific location anyway - not relative and not absolute.
I'm using a few short sound files, not 3 GB. The issue is not exactly the search path, but specifying a path *within* the search path.
Auto-populate and prefix are excellent suggestions to streamline what I'm doing. I looked at them a long time ago, but should revisit. However, in order to use them I have to straighten the path situation out.
Let me try it this way: If I was to use the prefix message to auto-populate [umenu], what would the prefix path be? The absolute path on my hard drive works, but that's going to break if the project is moved or a standalone is made. What is a path that will work when patching and also when as a standalone?
Thanks,
Brian
"but specifying a path *within* the search path."
ah, i missed that we are talking about [umenu] :)
(because otherwise you dont need pathes inside the search path, chris rolfe´s second post normally covered it all already)
another question, do these files change? i.e. why do you need to "find" them and not just type the names into the menu?
I use this old way of first detecting if patch or runtime is running,
then either get path from thispatcher or asking max to send path to Standalone application.
Also standalone could use path from thispatcher object, but it
would then be path to mxf file.
P.S. when compiling Standalones it is important to clear all
local paths and other leftovers which are local only.
I usually use one RESET message before compiling
to set whole app in wished default state, here few examples
prefix <none> wipes last used autopopulate path

Not sure if my second reply came through but I wanted to add that my initial comment left out pertinent settings, like disabling Max Projects' option to keep projects organized. This removes any unrecognized directories.
A standalone example would be useful here but AFAIK there's no official SDK version. A google search of site:github.com max msp "standalone" gives a few results:
https://github.com/joeyhook/Moog/commit/18cf77a6b63efc9421af7e1b742d0276fa6b3ac0
https://github.com/RTcmix/RTcmix/blob/master/README.embed
I'm currently porting a standalone from Max 6 to run in Max 8 under Catalina and Big Sur. I'll happily share my experience here when that port is completed. Stay tuned.
Cheers,
Chris