code: @VisibleForTesting
      /*private*/ static void checkRawBuildsDir(String newBuildsDirValue) throws InvalidBuildsDir {
  
          // do essentially what expandVariablesForDirectory does, without an Item
          String replacedValue = expandVariablesForDirectory(newBuildsDirValue,
                                                             "doCheckRawBuildsDir-Marker:foo",
                                                             Jenkins.getInstance().getRootDir().getPath() + "/jobs/doCheckRawBuildsDir-Marker$foo");
  
          File replacedFile = new File(replacedValue);
          if (!replacedFile.isAbsolute()) {
              throw new InvalidBuildsDir(newBuildsDirValue + " does not resolve to an absolute path");
          }
  
          if (!replacedValue.contains("doCheckRawBuildsDir-Marker")) {
              throw new InvalidBuildsDir(newBuildsDirValue + " does not contain ${ITEM_FULL_NAME} or ${ITEM_ROOTDIR}, cannot distinguish between projects");
          }
  
          if (replacedValue.contains("doCheckRawBuildsDir-Marker:foo")) {
              // make sure platform can handle colon
              try {
                  File tmp = File.createTempFile("Jenkins-doCheckRawBuildsDir", "foo:bar");
                  tmp.delete();
              } catch (IOException e) {
                  throw new InvalidBuildsDir(newBuildsDirValue +  " contains ${ITEM_FULLNAME} but your system does not support it (JENKINS-12251). Use ${ITEM_FULL_NAME} instead");
              }
          }
  
          File d = new File(replacedValue);
          if (!d.isDirectory()) {
              // if dir does not exist (almost guaranteed) need to make sure nearest existing ancestor can be written to
              d = d.getParentFile();
              while (!d.exists()) {
                  d = d.getParentFile();
              }
              if (!d.canWrite()) {
                  throw new InvalidBuildsDir(newBuildsDirValue +  " does not exist and probably cannot be created");
              }
          }
      }
docs: Checks the correctness of the newBuildsDirValue for use as {@link #buildsDir}.
  @param newBuildsDirValue the candidate newBuildsDirValue for updating {@link #buildsDir}.