MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getFileList

Method getFileList

ij/src/main/java/ij/macro/Functions.java:1665–1703  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1663 }
1664
1665 Variable[] getFileList() {
1666 String dir = getStringArg();
1667 File f = new File(dir);
1668 if (!f.exists() || !f.isDirectory())
1669 return new Variable[0];
1670 String[] list = f.list();
1671 if (list==null)
1672 return new Variable[0];
1673 if (!IJ.isWindows())
1674 Arrays.sort(list);
1675 File f2;
1676 int hidden = 0;
1677 for (int i=0; i<list.length; i++) {
1678 if (list[i].startsWith(".") || list[i].equals("Thumbs.db")) {
1679 list[i] = null;
1680 hidden++;
1681 } else {
1682 f2 = new File(dir, list[i]);
1683 if (f2.isDirectory())
1684 list[i] = list[i] + "/";
1685 }
1686 }
1687 int n = list.length-hidden;
1688 if (n<=0)
1689 return new Variable[0];
1690 if (hidden>0) {
1691 String[] list2 = new String[n];
1692 int j = 0;
1693 for (int i=0; i<list.length; i++) {
1694 if (list[i]!=null)
1695 list2[j++] = list[i];
1696 }
1697 list = list2;
1698 }
1699 Variable[] array = new Variable[n];
1700 for (int i=0; i<n; i++)
1701 array[i] = new Variable(0, 0.0, list[i]);
1702 return array;
1703 }
1704
1705 Variable[] newArray() {
1706 if (interp.nextToken()!='(' || interp.nextNextToken()==')') {

Callers 1

getArrayFunctionMethod · 0.95

Calls 7

getStringArgMethod · 0.95
isWindowsMethod · 0.95
startsWithMethod · 0.80
existsMethod · 0.45
listMethod · 0.45
sortMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected