@@ -83,14 +83,18 @@ def appendIJ1plugins(string) {
8383 return string
8484}
8585
86- def appendLocalFiles (string ) {
87- def header = FileUtils . shortenPath(Utils . getBARDir())
88- string + = " \n ## Local Files ($header )\n "
89- def dir = new File (Utils . getBARDir())
90- dir. eachFileRecurse(FileType . FILES ) {
91- string + = " 1. ${ it.path - dir.path} \n "
86+ def appendLocalFiles (string , path ) {
87+ def dir = new File (path)
88+ files = []
89+ if (dir. exists()) {
90+ def header = FileUtils . shortenPath(path)
91+ string + = " \n ### $header \n "
92+ dir. eachFileRecurse(FileType . FILES ) {
93+ files << it. path - dir. path
94+ string + = " 1. ${ files.last()} \n "
95+ }
9296 }
93- return string
97+ return new Tuple ( string, files . size())
9498}
9599
96100// List resources in BAR jar file
@@ -101,7 +105,9 @@ text = appendResources(text, ["boilerplate", "lib", "script_templates",
101105 " shared" , " tools" , " tutorials" ])
102106
103107// List user files on local installation
104- text = appendLocalFiles(text)
108+ text + = " \n ## Local Files\n "
109+ text = appendLocalFiles(text, Utils . getBARDir()). get(0 )
110+ (text, nfiles) = appendLocalFiles(text, Utils . getPluginsBasedBARDir())
105111
106112// Render markdown list
107113temp = File . createTempFile(' barlist' , ' .md' )
@@ -110,11 +116,12 @@ displayservice.createDisplay("BAR Files", textservice.asHTML(temp))
110116temp. delete()
111117
112118// Check for legacy installation files
113- if (new File ( Utils . getPluginsBasedBARDir()) . list() ) {
119+ if (nfiles > 0 ) {
114120 uiservice. showDialog(" <html><div WIDTH=450>With BAR v1.5 and newer, local files are no "
115121 + " longer rooted in the plugins directory. The new, much more convenient directory "
116122 + " for your local files is <b>${ Utils.getBARDir()} </b>. You should move any files "
117123 + " in the old location to the new one (and safely delete the old directory).<br><br>"
118124 + " Old location: <i>${ Utils.getPluginsBasedBARDir()} </i><br>"
119- + " New location: <i>${ Utils.getBARDir()} </i>" , " Legacy Warning" )
125+ + " New location: <i>${ Utils.getBARDir()} </i><br>" , " Legacy Warning" )
126+ Utils . revealFile(Utils . getPluginsBasedBARDir())
120127}
0 commit comments