001/* 002 * Renderer 4. The MIT License. 003 * Copyright (c) 2022 rlkraft@pnw.edu 004 * See LICENSE for details. 005*/ 006 007package renderer.scene.util; 008 009import java.util.Properties; 010import java.io.FileInputStream; 011import java.io.File; 012import java.io.IOException; 013 014/** 015 Use a {@link Properties} file to find the path to the assets directory. 016*/ 017public class Assets 018{ 019 /** 020 Use a {@link Properties} file to find the path to the assets directory. 021 022 @return a {@link String} containing the path to the assets folder 023 */ 024 public static String getPath() 025 { 026 final Properties properties = new Properties(); 027 try 028 { 029 properties.load( 030 new FileInputStream( 031 new File("assets.properties"))); 032 } 033 catch (IOException e) 034 { 035 e.printStackTrace(System.err); 036 System.exit(-1); 037 } 038 return properties.getProperty("assets"); 039 } 040 041 042 043 // Private default constructor to enforce noninstantiable class. 044 // See Item 4 in "Effective Java", 3rd Ed, Joshua Bloch. 045 private Assets() { 046 throw new AssertionError(); 047 } 048}