getLicensePath static method

String getLicensePath()

Retrieves the license path.

return The license path. throws FaceException An error has occurred during Face Library execution.

Implementation

static String getLicensePath() {
  Pointer<Char> pLicensePath = calloc.allocate(256);
  Pointer<Int> pLicensePathSize = calloc.allocate(1);
  pLicensePathSize[0] = 256;
  try {
    var err = faceSDK.id3FaceLicense_GetLicensePath(pLicensePath, pLicensePathSize);
    if (err == FaceError.insufficientBuffer.value) {
      calloc.free(pLicensePath);
      pLicensePath = calloc.allocate(pLicensePathSize.value);
      err = faceSDK.id3FaceLicense_GetLicensePath(pLicensePath, pLicensePathSize);
      if (err != FaceError.success.value) {
        throw FaceException(err);
      }
    }
    final vLicensePath = utf8.decode(Uint8List.fromList(pLicensePath.cast<Uint8>().asTypedList(pLicensePathSize.value)));
    return vLicensePath;
  } finally {
    calloc.free(pLicensePath);
    calloc.free(pLicensePathSize);
  }
}