Skip to content

Commit

Permalink
don't set the new haxelib unless we've already established we're usin…
Browse files Browse the repository at this point in the history
…g a devpath
  • Loading branch information
ninjamuffin99 committed Aug 26, 2024
1 parent 178ce0c commit d99f937
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Binary file modified run.n
Binary file not shown.
15 changes: 11 additions & 4 deletions src/haxelib/api/Repository.hx
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ class Repository {
throw 'Library $name version $version is not installed';

final current = getCurrentFileContent(name);
if (getDevPath(name) == null && current == version)
throw 'Cannot remove current version of library $name, it\'s set as the current version';
final installationInfo = getProjectInstallationInfo(name);

if (installationInfo.devPath == null && current == version)
throw 'Cannot remove current version of library $name';

try {
confirmRemovalAgainstDev(name, versionPath);
Expand All @@ -182,8 +184,13 @@ class Repository {

FsUtils.deleteRec(versionPath);

var versions = getProjectInstallationInfo(name).versions.pop();
setCurrentVersion(name, versions);
// Dev path is set here definitely, since we've had a previous check earlier that would throw if this and dev path were true
if (current == version)
{
var latestVersion = installationInfo.versions.pop();
setCurrentVersion(name, latestVersion);
}

}

/** Throws an error if removing `versionPath` conflicts with the dev path of library `name` **/
Expand Down

0 comments on commit d99f937

Please sign in to comment.