aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/scala/spark/SparkFiles.java
blob: 566aec622c096076f3d91dbd433297d9f2c53a8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package spark;

import java.io.File;

/**
 * Resolves paths to files added through `SparkContext.addFile()`.
 */
public class SparkFiles {

  private SparkFiles() {}

  /**
   * Get the absolute path of a file added through `SparkContext.addFile()`.
   */
  public static String get(String filename) {
    return new File(getRootDirectory(), filename).getAbsolutePath();
  }

  /**
   * Get the root directory that contains files added through `SparkContext.addFile()`.
   */
  public static String getRootDirectory() {
    return SparkEnv.get().sparkFilesDir();
  }
}