Skip to content

Commit 87f3ddd

Browse files
authored
add support for empty filenames (#14)
* add support for empty filenames * add option to enable or disable allowing empty file names
1 parent 6726c27 commit 87f3ddd

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

cls/Port/Configuration.cls

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,21 @@ ClassMethod RewritePlaceHolders(basePath As %String, projectName As %String = {$
208208
return translatedPath
209209
}
210210

211+
/// Enable or disable enqueing files that follow the format ".name". When disabled
212+
/// Port will ignore these files altogether. Useful if you don't want to import directories
213+
/// that there supposed to be internal or hidden.
214+
ClassMethod AllowEmptyFileName(enabledOrDisable As %Integer)
215+
{
216+
if '$lf($lb(0,1), value) quit
217+
set ^Port.Configuration("files.allowEmptyName") = value
218+
}
219+
220+
/// Returns if Port is allowed to enqueue files on which the name follows the format ".name".
221+
ClassMethod IsAllowEmptyFileNameEnabled() As %Boolean
222+
{
223+
return $get(^Port.Configuration("files.allowEmptyName"), 0)
224+
}
225+
226+
211227
}
212228

cls/Port/Project/Importer.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ Method DescribeItem(origin As %String, Output isOutdated As %Boolean = 0, Output
123123
{
124124

125125
set fileName = ##class(%File).GetFilename(origin)
126-
set emptyName = ($piece(fileName, ".") = "")
126+
set allowEmptyName = ##class(Port.Configuration).IsAllowEmptyFileNameEnabled() && ($piece(fileName, ".") = "")
127127
set pathType = ##class(Port.Util).GetPathType(origin)
128128

129129
set isOutdated = 1
130130
set itemName = ##class(Port.Util).PathToItem(origin)
131131
set itemType = ##class(Port.Util).GetItemType(itemName)
132132
set priority = ..GetTypePriority(itemType)
133133

134-
if emptyName || (pathType '= itemType && (pathType '= "PUBLIC")) {
134+
if allowEmptyName || (pathType '= itemType && (pathType '= "PUBLIC")) {
135135
set itemName = ""
136136
set itemType = ""
137137
set priority = -1

0 commit comments

Comments
 (0)