MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / positionModelItem

Function positionModelItem

renderer.js:20122–20141  ·  view source on GitHub ↗
(item, row, col)

Source from the content-addressed store, hash-verified

20120 // If somehow we got a file path, extract the parent directory again
20121 const parentSlash = Math.max(directoryFilterPath.lastIndexOf('\\'), directoryFilterPath.lastIndexOf('/'));
20122 directoryFilterPath = parentSlash > 0 ? directoryFilterPath.substring(0, parentSlash) : '';
20123 }
20124 } else {
20125 directoryFilterPath = '';
20126 }
20127 }
20128
20129 // Validate that we have a directory path, not a file path
20130 // Check for common file extensions (case-insensitive)
20131 const lowerPath = directoryFilterPath.toLowerCase();
20132 if (directoryFilterPath && (lowerPath.endsWith('.zip') || lowerPath.endsWith('.stl') || lowerPath.endsWith('.3mf') || lowerPath.endsWith('.obj') || lowerPath.endsWith('.ply'))) {
20133 console.warn('Directory filter appears to be a file path, extracting parent directory:', directoryFilterPath);
20134 const lastSlash = Math.max(directoryFilterPath.lastIndexOf('\\'), directoryFilterPath.lastIndexOf('/'));
20135 directoryFilterPath = lastSlash > 0 ? directoryFilterPath.substring(0, lastSlash) : '';
20136 }
20137
20138 // Final validation: ensure we don't have a file path
20139 if (directoryFilterPath && directoryFilterPath === model.filePath) {
20140 console.error('Directory filter is same as file path, this should not happen. File path:', model.filePath);
20141 const lastSlash = Math.max(directoryFilterPath.lastIndexOf('\\'), directoryFilterPath.lastIndexOf('/'));
20142 directoryFilterPath = lastSlash > 0 ? directoryFilterPath.substring(0, lastSlash) : '';
20143 }
20144

Callers 1

renderVisibleItemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected