From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC

XDCscript - xdc.findFile

Find file along the package path

Contents

Synopsis

 
var path = xdc.findFile(fileName);

Parameters

fileName 
string name of a file to be located

Description

xdc.findFile searches for the file named fileName along the current package path. xdc.findFile searches for fileName according to the following algorithm:

  1. If fileName is an absolute path or begins with "./": findFile returns fileName if it exists; otherwise, it returns null.
  2. If fileName is a relative path that does not start with "./": the following directories are searched in order:
    • the current script directory (see xdc.csd())
    • the directories specified by the RTSC package path
    • If the file can not be found in these directories, null is returned.

Return Value

xdc.findFile returns a path name of a file that exists or null if no file can be found. The path returned may be absolute or relative to the current working directory.

Example

To locate the file named std.h relative to the package ti.bios:

 
var path = xdc.findFile("ti/bios/std.h");

Notice how the '.'s in the package name are replaced with '/'s in the argument to xdc.findFile. Always use '/' to separate directories even on Windows hosts; Windows supports both '/' and '\' as directory separators whereas UNIX systems only support '/'.

[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved


Views
Personal tools
package reference