tajihiro
tajihiro

Reputation: 2443

Atom How can I get files under the project

I'm using Atom 1.0.5. I'm trying to create atom package.

I would like to get files name under the workspace.

Is it possible?

dirs = atom.project.getDirectories()
for dir in dirs
  for entry in dir.getEntriesSync()
    console.log entry.getPath()

Upvotes: 1

Views: 339

Answers (1)

nwinkler
nwinkler

Reputation: 54507

You should be able to use the following two APIs:

So you would use Project.getDirectories first to get a list of directories, and then iterate through them using Directory.getEntries. Each entry can either be a file or a directory (again).

Upvotes: 1

Related Questions