Skip to content

Commit

Permalink
Merge branch 'pr-85'
Browse files Browse the repository at this point in the history
  • Loading branch information
haubi committed Sep 5, 2024
2 parents 93badea + 6d701ab commit 4389525
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import org.eclipse.xtext.validation.Check

import static com.wamas.ide.launching.lcDsl.LaunchConfigType.*
import org.eclipse.jdt.core.IType
import java.util.regex.Pattern

/**
* This class contains custom validation rules.
Expand Down Expand Up @@ -325,15 +326,31 @@ class LcDslValidator extends AbstractLcDslValidator {
@Check
def checkPathExists(ExistingPath p) {
try {
val value = p.name.value
if(value.blank){
warning("No path entered", p, LC.path_Name)
return
}

if(containsVariablePattern(value)){
return
}

val x = p.name.expanded
val f = new File(x);
val f = new File(x)
if (!f.exists) {
warning("Path " + x + " does not exist", p, LC.path_Name)
}
} catch (CoreException e) {
warning(e.message, LC.path_Name)
}
}

def containsVariablePattern(String value) {
val pattern = '\\$\\{([^}]+)\\}'
val matcher = Pattern.compile(pattern).matcher(value)
return matcher.find ? true : false
}

@Check
def checkTestContainer(LaunchConfig cfg) {
Expand Down

0 comments on commit 4389525

Please sign in to comment.