Kara-Moon Forum
June 17, 2024, 05:44:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: SetLibPath with relative path  (Read 1943 times)
infojunkie
Jr. Member
*
Posts: 13


WWW
« on: May 13, 2022, 06:30:27 AM »

I'm trying to set the lib path to point to some custom libs located inside the current folder, at ./grooves/arabic. So I added
Code:
SetLibPath grooves $_LibPath
to my mmarc, and ran mma -g to rebuild the database.

But when I run a file that uses one of my custom grooves, I get the error:
Quote
Error: <Line 36> <File:test/data/salma-ya-salama.mma> Unable to locate library file 'grooves/arabic/grooves/arabic/maqsum.mma'

Notice the repetition of grooves/arabic.

This error goes away if I set the lib path to be absolute. It's kind of a pain because I'd like my mmarc to be valid wherever I happen to create my folder.

Am I missing something, or is this expected?

Thanks!
Logged

bvdp
Kara-Moon Master
****
Posts: 1446


WWW
« Reply #1 on: May 13, 2022, 04:13:05 PM »

Without doing much testing at this end (sorry, still up to my ass in alligators) you can test the current setting of any variable with the PRINT command. So, to verify that you are getting want you think do a

   Print $LibPath

right after the SetLibPath.

The manual has a section in Paths, Files and Directories on setting LibPath to a local value.

Please shout if this still is not working.
Logged

My online life: http://www.mellowood.ca
infojunkie
Jr. Member
*
Posts: 13


WWW
« Reply #2 on: May 14, 2022, 02:33:33 AM »

Quote
still up to my ass in alligators

I hope this is figurative and that you are otherwise enjoying yourself!  Grin

If I turn Debug on and rerun, I get the following output:
Code:
LibPath expansion set to: grooves grooves/arabic /home/kratib/src/infojunkie/mma/lib /home/kratib/src/infojunkie/mma/lib/yamaha
    /home/kratib/src/infojunkie/mma/lib/kara /home/kratib/src/infojunkie/mma/lib/alexis /home/kratib/src/infojunkie/mma/lib/stdlib
    /home/kratib/src/infojunkie/mma/lib/casio /home/kratib/src/infojunkie/mma/lib/pflib /home/kratib/src/infojunkie/mma/lib/zoom
LibPath set: grooves /home/kratib/src/infojunkie/mma/lib
and further down
Code:
Groove 'MAQSUM' not defined. Trying auto-load from libraries
Attempting to load groove 'MAQSUM' from 'grooves/arabic/grooves/arabic/maqsum.mma'.
Error: <Line 36> <File:test/data/salma-ya-salama.mma> Unable to locate library file 'grooves/arabic/grooves/arabic/maqsum.mma'

If I replace with a full path, the maqsum.mma file is located correctly.
Logged

bvdp
Kara-Moon Master
****
Posts: 1446


WWW
« Reply #3 on: May 14, 2022, 04:10:09 PM »

Yes, in order to be "all encompassing" the coding pretty much assumes complete path names. This is pretty easy to achieve in init files ... so, I'll not consider that a bug, just a feature Smiley

However, as to the very strange path expansion with the duplicated parts? Well, that is something I will look at. I'm hoping to do that and to incorporate you BASS changes in the next few days.

As to the alligators ... well if only this spring was warm enough here in the mountains on British Columbia for alligators to survive Smiley

 
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1446


WWW
« Reply #4 on: May 15, 2022, 02:40:57 AM »

I still don't understand the error message that is being created ... I'll leave that 'til tomorrow.

However, if you want to use custom directories for your grooves the simplest and error proof (and recommended) is to:

   - Create a directory with your grooves. We'll just call it "grooves" for now. It can be anywhere.
   - I'm assuming that you have a groove file "grooves/samba" and it defines a "mysamba" groove.
   - To use it, use extended notation:
           Groove grooves/samba:mysamba

Now, so long as "grooves" is in the current directory this will work. If you have moved to a different location, just extend the path notation. And if you want to really "cool" you can always set the path name in a macro defined in an init file Smiley

Just to confuse a bit more: the env variable MMA_LIBPATH can also be used on the command line. In this case the list of directories are INSERTED into the existing setting.

I hope this is helpful. And, yes, I know: Figure out the stupid error message!!!!!


Do NOT do a "mma -g". It will just confuse things Smiley

Also note that ALL the grooves defined in the file "mysamba" will be brought into the compile session. So (assuming the file contains "mysamba1", "mysamba2" and even "foobar" you can now enable these with simple groove commands.

For future readers: This is detailed in the Extended Groove Notation section of the find manual.


   
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.037 seconds with 19 queries.