MIDI2LR icon indicating copy to clipboard operation
MIDI2LR copied to clipboard

How can I send new directory/current directory to the server/DB?

Open StevenKersting opened this issue 10 years ago • 3 comments

I have edited the profiles.lua so many ways w/o affecting the behavior. I concluded that local function changeProfile(profilename, ignoreCurrent) pretty much runs regardless. To confirm that I commented out all previous local functions (breaking the notification) and all "if statements" w/in the changeProfile function. And it ran exactly the same.

So, I need to write the current folder to the server or DB. Or possibly modify the line MIDI2LR.SERVER:send('SwitchProfile '..newprofile_file..'\n') to include the current folder. But I don't know how.

Other somewhat related questions: Where do these lines get their information from?

local loadedprofile = ''-- according to application and us
local profilepath = '' --according to application

From what I can see, at that point in the file they are undefined. And where does "value" come from for the other local functions? I don't see this information defined in any of the import/require files. Are these defined in a global somewhere?

StevenKersting avatar Feb 09 '16 21:02 StevenKersting

The plugin listens for messages from the app. That's how it fills those variables.

For example, in ProfileManager.cpp, switchToProfile(const String&), which is where profile switching ends up in the app, has the following:

        if (m_lr_IPC_OUT)
        {
            String command = String("ChangedToDirectory ") + File::addTrailingSeparator(_profileLocation.getFullPathName()) + String("\n");
            m_lr_IPC_OUT->sendCommand(command);
            command = String("ChangedToFile ") + profile + String("\n");
            m_lr_IPC_OUT->sendCommand(command);
        }

So when a profile switch occurs, directory and file information is sent to the plugin.

It also sends directory information whenever it is reconnected to the plugin (see the connected() method in the same file).

The app only changes the directory when the load profile is opened in the SettingsComponent.cpp, when setProfileDirectory is called.

rsjaffe avatar Feb 10 '16 03:02 rsjaffe

Is there a problem with my installation? The profile directory isn't recalled when "choose profile location" is clicked. If I want to change the profile folder setting/location I always have to start from the root (applications) folder. I believe that previous versions would open the last directory stored and you would have to navigate from that location to the new folder. I do not believe this affects anything else.

StevenKersting avatar Feb 10 '16 13:02 StevenKersting

I've given up on changing the directory and just went with expanded profiles (a lot of redundancy w/in profiles).

What I thought was working (using LrPathUtils) isn't, at least not consistently.

StevenKersting avatar Feb 13 '16 21:02 StevenKersting