/** * Returns the absolute path corresponding to the given fully qualified name. * * @param fullyQualifiedName a fully qualified name * @param extension the file extension to add at the end of the returned path. * May be <code>null</code> * @return the absolute path corresponding to the given fully qualified name. */ public static String fullyQualifiedNameToPath( final String fullyQualifiedName, final String extension) { return fullyQualifiedNameToPath(fullyQualifiedName, null, extension); }
public static String toCPath(final String s) { if (PathHelper.isRelative(s)) return "./" + s; else return s.substring(1); }
/** * Returns the absolute path that is denoted by the given <code>path</code> * relatively to the directory that correspond to the package name of the * given fully-qualified name. If the given path is not a relative path (see * {@link #isRelative(String)}), this method returns the given * <code>path</code>. * * @param fullyQualifiedName a fully qualified name * @param path a valid path (see {@link #isValid(String)}). * @return the absolute path that is denoted by the given <code>path</code> * relatively to the directory that correspond to the package name of * the given fully-qualified name. * @see #fullyQualifiedNameToDirName(String) * @see #toAbsolute(String, String) */ public static String fullyQualifiedNameToAbsolute( final String fullyQualifiedName, final String path) { return toAbsolute(fullyQualifiedNameToDirName(fullyQualifiedName), path); }
/** * Returns the absolute path that is denoted by the given <code>path</code> * relatively to the directory that correspond to the given package name. If * the given path is not a relative path (see {@link #isRelative(String)}), * this method returns the given <code>path</code>. * * @param packageName a package name * @param path a valid path (see {@link #isValid(String)}). * @return the absolute path that is denoted by the given <code>path</code> * relatively to the directory that correspond to the given package * name. * @see #packageNameToDirName(String) * @see #toAbsolute(String, String) */ public static String packageNameToAbsolute(final String packageName, final String path) { return toAbsolute(packageNameToDirName(packageName), path); }
if (!isValid(outputPath)) { if (isRelative(outputPath)) { outputPath = "/" + outputPath; outputPath = fullyQualifiedNameToPath(graph.getDefinition().getName(), null);
public void visit(final IDL idl, final Map<Object, Object> context) throws ADLException { final String headerFileName; if (idl.getName().startsWith("/")) { headerFileName = PathHelper.replaceExtension(idl.getName(), IDT_FILE_EXT); } else { headerFileName = PathHelper.fullyQualifiedNameToPath(idl.getName(), ITF_FILE_EXT); } final File headerFile = outputFileLocatorItf.getCSourceOutputFile( headerFileName, context); if (!inputResourceLocatorItf.isUpToDate(headerFile, InputResourcesHelper .getInputResources(idl), context)) { final StringTemplate st = getInstanceOf("idlFile"); st.setAttribute("idl", idl); try { writeToFile(headerFile, st.toString()); } catch (final IOException e) { throw new CompilerError(IOErrors.WRITE_ERROR, e, headerFile .getAbsolutePath()); } } }
if (!isRelative(path)) return path; .substring(3); return toAbsolute(dirName.substring(0, lastSlash - 1), "./" + path.substring(3));
replaceExtension(instancesFileName, ".i"), context); final File mppFile = outputFileLocatorItf.getCSourceOutputFile( replaceExtension(instancesFileName, ".mpp.c"), context); final File objectFile = outputFileLocatorItf.getCCompiledOutputFile( replaceExtension(instancesFileName, ".o"), context);
/** * Replaces the file extension of the given path by the given extension * * @param path a valid path (see {@link #isValid(String)}). * @param extension the extension to set. If <code>extension</code> does not * starts with ".", it is automatically added. * @return the given path in which the file extension has been replaced by the * given one. */ public static String replaceExtension(final String path, String extension) { if (!extension.startsWith(".")) extension = "." + extension; return removeExtension(path) + extension; }
/** * Returns the directory name that correspond to the package name of the given * fully qualified name. * * @param fullyQualifiedName a fully qualified name * @return the directory name that correspond to the package name of the given * fully qualified name. */ public static String fullyQualifiedNameToDirName( final String fullyQualifiedName) { final String packageName = getPackageName(toValidName(fullyQualifiedName)); if (packageName == null) return "/"; return packageNameToDirName(packageName); }
replaceExtension(path, ".i"), context); final File mppFile = outputFileLocatorItf.getCSourceOutputFile( replaceExtension(path, ".mpp.c"), context); final File objectFile = outputFileLocatorItf.getCCompiledOutputFile( replaceExtension(path, ".o"), context);
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getMacroFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
public File getCCompiledOutputFile(final String path, final Map<Object, Object> context) throws ADLException { if (isRelative(path)) throw new IllegalArgumentException("path must be absolute"); final File outDir = getOutputDir(context); return mkdirs(new File(outDir, path)); }
replaceExtension(sharedImplementation, ".o"), context); final CompilerCommand command = compilerWrapperItf .newCompilerCommand(context);
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getHeaderFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
public File getCSourceOutputFile(final String path, final Map<Object, Object> context) throws ADLException { if (isRelative(path)) throw new IllegalArgumentException("path must be absolute"); final File outDir = getOutputDir(context); return mkdirs(new File(outDir, path)); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getIncFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
public File getMetadataOutputFile(final String path, final Map<Object, Object> context) throws ADLException { if (isRelative(path)) throw new IllegalArgumentException("path must be absolute"); final File outDir = getOutputDir(context); return mkdirs(new File(outDir, path)); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getImplHeaderFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), "_impl", ".h"); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getCtrlImplFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_SUFFIX, FILE_EXT); }