All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.thucydides.core.util.FileSystemUtils Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package net.thucydides.core.util;

import java.io.File;

/**
 * Created by john on 29/06/2014.
 */
public class FileSystemUtils {
    public static File getResourceAsFile(String resourceName) {
        return new File(Thread.currentThread().getContextClassLoader().getResource(stripLeadingSlash(resourceName)).getFile().replaceAll("%20"," "));
    }

    private static String stripLeadingSlash(String resourceName) {
        return (resourceName.startsWith("/")) ? resourceName.substring(1) : resourceName;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy