Skip to content

Commit

Permalink
Merge pull request #761 from Nnoggie/master
Browse files Browse the repository at this point in the history
Allow force updating of profiles without changing profile key
  • Loading branch information
Tercioo authored Jun 25, 2024
2 parents 00e5097 + 2566647 commit 136451e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1940,8 +1940,9 @@ end
---@param newProfileName string
---@param bImportAutoRunCode boolean
---@param bIsFromImportPrompt boolean
---@param overwriteExisting boolean
---@return boolean
function Details:ImportProfile (profileString, newProfileName, bImportAutoRunCode, bIsFromImportPrompt)
function Details:ImportProfile (profileString, newProfileName, bImportAutoRunCode, bIsFromImportPrompt, overwriteExisting)
if (not newProfileName or type(newProfileName) ~= "string" or string.len(newProfileName) < 2) then
Details:Msg("invalid profile name or profile name is too short.") --localize-me
return false
Expand All @@ -1955,11 +1956,13 @@ function Details:ImportProfile (profileString, newProfileName, bImportAutoRunCod

local profileObject = Details:GetProfile (newProfileName, false)
local nameWasDuplicate = false
while(profileObject) do
newProfileName = newProfileName .. '2';
profileObject = Details:GetProfile(newProfileName, false)
nameWasDuplicate = true
end
if not overwriteExisting then
while(profileObject) do
newProfileName = newProfileName .. '2';
profileObject = Details:GetProfile(newProfileName, false)
nameWasDuplicate = true
end
end
if (not profileObject) then
--profile doesn't exists, create new
profileObject = Details:CreateProfile (newProfileName)
Expand Down

0 comments on commit 136451e

Please sign in to comment.