- Timestamp:
- May 1, 2018 3:15:44 AM (3 years ago)
- Branches:
- master
- Children:
- 975d8a0
- Parents:
- a3a8ee1
- Location:
- launchers/common/src/main/scala/net/i2p/launchers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
launchers/common/src/main/scala/net/i2p/launchers/DeployProfile.scala
ra3a8ee1 r2d15f8e1 4 4 5 5 6 /** 7 * 8 * This is a singleton ish style. It's an object - it was never a class. 9 * However it has a class-"brother/sister" 10 * 11 * objects like this should be considered like containers for java's 12 * public static methods. 13 * 14 * Many classes/objects benefits from pathJoin, so therefore it's defined 15 * as an "public static method". 16 * 17 * @since 0.9.35 18 */ 6 19 object DeployProfile { 7 20 -
launchers/common/src/main/scala/net/i2p/launchers/OSXDeployment.scala
ra3a8ee1 r2d15f8e1 158 158 159 159 /** 160 * Please note that in Scala, the constructor body is same as class body. 161 * What's defined outside of methods is considered constructor code and 162 * executed as it. 163 * 164 * 165 * 160 166 * a map function work as a loop with some built in security 161 167 * for "null" objects. … … 166 172 * the match case is controlling the flow based upon which type of object it is. 167 173 */ 168 staticFilesFromResources.map { fd => fd.getContent match { 169 case Left(is) => { 170 // Write file 171 if (!new File(DeployProfile.pathJoin(baseDir, fd.getPath)).exists()) { 172 println(s"copyBaseFileResToDisk(${fd.getPath})") 173 try { 174 copyBaseFileResToDisk(fd.getPath, is) 175 } catch { 176 case ex:IOException => println(s"Error! Exception ${ex}") 174 staticFilesFromResources.map { 175 fd => fd.getContent match { 176 // Case subject is a file/resource 177 case Left(is) => { 178 // Write file 179 if (!new File(DeployProfile.pathJoin(baseDir, fd.getPath)).exists()) { 180 println(s"copyBaseFileResToDisk(${fd.getPath})") 181 try { 182 copyBaseFileResToDisk(fd.getPath, is) 183 } catch { 184 case ex:IOException => println(s"Error! Exception ${ex}") 185 } 177 186 } 178 187 } 188 // Case subject is a directory 189 case Right(dir) => { 190 // Ensure directory 191 println(s"Directory(${fd.getPath})") 192 if (!new File(DeployProfile.pathJoin(baseDir,fd.getPath)).exists()) { 193 new File(DeployProfile.pathJoin(baseDir,fd.getPath)).mkdirs() 194 } 195 dir.map { f => createFileOrDirectory(f,fd.filesIsDirectories) } 196 } 179 197 } 180 case Right(dir) => { 181 // Ensure directory 182 println(s"Directory(${fd.getPath})") 183 if (!new File(DeployProfile.pathJoin(baseDir,fd.getPath)).exists()) { 184 new File(DeployProfile.pathJoin(baseDir,fd.getPath)).mkdirs() 185 } 186 dir.map { f => createFileOrDirectory(f,fd.filesIsDirectories) } 187 } 188 } } 198 } 189 199 190 200 }
Note: See TracChangeset
for help on using the changeset viewer.