|
|
@ -4,9 +4,13 @@ import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
public class HolaFichero { |
|
|
|
private static File directorioWindow = new File("C:\\Users\\AntonioFrische\\OneDrive - ABACCO Solutions\\Documents\\Schule_22_23_CFGS\\Acceso_Datos\\SpringTool_4"); |
|
|
|
private static File directorioLinux = new File("/home/user"); |
|
|
|
|
|
|
|
public static void main(String args[]) { |
|
|
|
|
|
|
|
public static void main(String args[]) throws IOException { |
|
|
|
char sisChar = systemCheck(); |
|
|
|
crearFichero(sisChar); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -21,4 +25,23 @@ public class HolaFichero { |
|
|
|
} |
|
|
|
return osChar; |
|
|
|
} |
|
|
|
public static void crearFichero(char sisChar) throws IOException { |
|
|
|
if(sisChar == 'W') { |
|
|
|
System.out.println("Creando fichero en Windows ..."); |
|
|
|
File newFichero = new File (directorioWindow+File.separator+"HolaFichero.txt"); |
|
|
|
if (!newFichero.exists()) { |
|
|
|
newFichero.createNewFile(); |
|
|
|
} |
|
|
|
System.out.println("Fichero creado en Windows."); |
|
|
|
} |
|
|
|
else { |
|
|
|
System.out.println("Creando fichero en Linux ..."); |
|
|
|
File newFichero = new File (directorioLinux+File.separator+"HolaFichero.txt"); |
|
|
|
if (!newFichero.exists()) { |
|
|
|
newFichero.createNewFile(); |
|
|
|
} |
|
|
|
System.out.println("Fichero creado en Linux."); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |