Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getDirectory(String path) {
        String osName = System.getProperty("os.name");
        // test(osName);
        if (osName.contains("Win")) {
            path = path.substring(0, path.lastIndexOf('\\') + 1);
        } else {
            path = path.substring(0, path.lastIndexOf('/') + 1);
        }
        return path;
    }
}