|
|
|
10-19-2018, 04:19 AM
|
#1
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
GetProjectPath() returns recording path?
Hello!
GetProjectPath() seems to return the recording path. So in my case it returnds (project path)/Audio
Is it possible to get just the (project path)?
Thanks!
Last edited by amagalma; 10-19-2018 at 05:18 AM.
|
|
|
10-19-2018, 05:42 AM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Maybe with EnumProjects(), which gives you the path(and filename) of the current project-file, after the project has been saved. This is usually also the path to the project.
Although, this might be a problem, when someone saves the project-file itself somewhere else, while having the "project-assets" at a different place, but this should be a rare problem, I suppose...
If that's the case, using the returned path of GetProjectPath() and getting rid of the last directory in it(in your case "/Audio", in most other cases "/Recording") should lead to the third possible projectfolder.
Using GetProjectPath() and EnumProjects() both should be good enough in most cases.
Management summary:
EnumProject() - the path to the RPP-File and often the projectpath
GetProjectPath() - the recording directory and, if you get rid of the last folder in the returned project-path-string, the other possible project-folder
|
|
|
10-19-2018, 06:31 AM
|
#3
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Thanks mespotine!
I found out that GetProjectPath() returns the actual project path if the project is not saved, but returns the recording path if the project is saved! :S
So to get the project path one should do this:
Code:
function GetCurrentProjPath()
local _, projfn = reaper.EnumProjects( -1, "" )
if projfn == "" then
return reaper.GetProjectPath("")
else
return string.match(projfn, ".+\\")
end
end
path = GetCurrentProjPath()
|
|
|
10-19-2018, 09:53 AM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
I found out that GetProjectPath() returns the actual project path if the project is not saved, but returns the recording path if the project is saved! :S
|
Oh, didn't know that tiny little detail, will add that to my Reaper-API-docs right away
May I use your function in my function-collection, that I'm currently working on? Properly credited of course...
|
|
|
10-19-2018, 11:22 AM
|
#5
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Yes, sure!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:41 PM.
|