Adds record of a new file, by filename and path.  The path
may be relative to a source compilation path.

@param filename the filename to add, unqualified by path
@param filePath the path for the filename, potentially relative
to a source compilation path
515853
public void addFile(String filename, String filePath) {
        int pathIndex = filePathList.indexOf(filePath);
        if (pathIndex == -1) {
            fileNameList.add(filename);
            filePathList.add(filePath);
        }
    }
46596
private synchronized void initialize(String fileName, String path) throws ParameterException {
		if(!path.equals(this.path)){
			checkPath(path);
			this.path = path;
		}
		if(!fileName.equals(this.fileName)){
			checkFileName(fileName);
			this.fileName = fileName;
		}
	}
337301
def add_filepath(self, manifest, filepath, fullpath, copy=False):
        
        filepath = os.path.normpath(filepath)
        if self.manifests[manifest].add_filepath(filepath, fullpath, copy):
            # Only link if filepath was added
            self.manifests[manifest].make_link(filepath)
177433
public function rename($filepath, $filename) {
        if ($this->fs->file_exists($this->get_contextid(), $this->get_component(), $this->get_filearea(), $this->get_itemid(), $filepath, $filename)) {
            $a = new stdClass();
            $a->contextid = $this->get_contextid();
            $a->component = $this->get_component();
            $a->filearea  = $this->get_filearea();
            $a->itemid    = $this->get_itemid();
            $a->filepath  = $filepath;
            $a->filename  = $filename;
            throw new file_exception('storedfilenotcreated', $a, 'file exists, cannot rename');
        }
        $filerecord = new stdClass;
        $filerecord->filepath = $filepath;
        $filerecord->filename = $filename;
        // populate the pathname hash
        $filerecord->pathnamehash = $this->fs->get_pathname_hash($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $filepath, $filename);
        $this->update($filerecord);
    }
1084930
public void addFile(String path, File file) throws IOException {
    addFile(path, file, null);
  }
841082
public static File newFile(String fileName) {
		File file = new File(fileName);
		if(file.exists())
			file.delete();
		return file;
	}
871534
public static void save(byte[] bytes,String filePath,String fileName) throws IOException {
        Path path = Paths.get(filePath, fileName);
        mkirDirs(path.getParent());
        String pathStr = path.toString();
        File file = new File(pathStr);
        write(bytes,file);
    }
1228328
public static File getFileFromClasspath(final String filePath) throws FileNotFoundException {
        try {
            URL fileURL = FileUtils.class.getClassLoader().getResource(filePath);
            if (fileURL == null) {
                throw new FileNotFoundException("File [" + filePath + "] could not be found in classpath");
            }
            return new File(fileURL.toURI());
        } catch (URISyntaxException e) {
            throw new FileNotFoundException("File [" + filePath + "] could not be found: " + e.getMessage());
        }
    }
929135
private static void loadFile(String filePath) {
        final Path path = FileSystems.getDefault().getPath(filePath);

        try {
            data.clear();
            data.load(Files.newBufferedReader(path));
        } catch(IOException e) {
            LOG.warn("Exception while loading " + path.toString(), e);
        }
    }
492468
public void addFile(String filename) {
        synchronized (files) {
            if (!files.contains(filename)) {
                files.add(filename);
            }
        }
    }
1254058
function addCompressionToFile(filePath, compression) {
        var srcFilePath = filePath.replace(rootFolder, "").replace(compression.fileExtension, "");
        var existingFile = files[srcFilePath];
        if (!existingFile) {
            files[srcFilePath] = { compressions: [compression] };
        } else {
            existingFile.compressions.push(compression);
        }
    }
376215
public void addFile(int level, long fileNumber,
            long fileSize,
            InternalKey smallest,
            InternalKey largest)
    {
        FileMetaData fileMetaData = new FileMetaData(fileNumber, fileSize, smallest, largest);
        addFile(level, fileMetaData);
    }
973347
public static void writeFile( List<String> lines, String filePath ) throws IOException {
        writeFile(lines, new File(filePath));
    }
959702
public static void copyFile(String fileName, String newFileName, boolean overwriteExisting) throws IOException {
		copyFile(new File(fileName), newFileName, overwriteExisting);
	}
1157662
public void addSourcePath(File sourcePath) {
		if (this.sourcePath == null) {
			this.sourcePath = new ArrayList<>();
		}
		this.sourcePath.add(sourcePath);
	}
1251161
private boolean validateFilePath(String filePath) {
        if (filePath == null || filePath.isEmpty()) {
            throw new IllegalArgumentException("filePath must be a valid filePath within the file system.");
        }

        // Check if the filename exists as a File -- use an absolute file to ensure we have
        // a parent: even if that parent is ${user.dir} ...
        File loc = new File(filePath).getAbsoluteFile();

        return (loc.exists() || loc.getParentFile().exists());
    }
791312
def _addFilename(self, filename):
        
        cur = self._connection.cursor()
        try:
            cur.execute('INSERT INTO files(name) VALUES (?)', (filename,))
        except sqlite3.IntegrityError as e:
            if str(e).find('UNIQUE constraint failed') > -1:
                raise ValueError('Duplicate file name: %r' % filename)
            else:
                raise
        else:
            fileNumber = cur.lastrowid
            self._connection.commit()
            return fileNumber