@@ -37,6 +37,7 @@ const queryCommand = require('../db/query-command.js')
3737const conformChecker = require ( '../validation/conformance-checker.js' )
3838const zclLoader = require ( '../zcl/zcl-loader.js' )
3939const generationEngine = require ( '../generator/generation-engine' )
40+ const path = require ( 'path' )
4041
4142/**
4243 * Resolves with a promise that imports session key values.
@@ -730,6 +731,46 @@ async function importEvents(
730731 }
731732}
732733
734+ /**
735+ * Checks if any package path is on a different drive than the zap file path (Windows only)
736+ * and sets appropriate warnings
737+ * @param {* } db
738+ * @param {* } packages
739+ * @param {* } zapFilePath
740+ * @param {* } sessionId
741+ */
742+ async function validatePackagePathDrive ( db , packages , zapFilePath , sessionId ) {
743+ // If zap file path is not a windows path, skip check
744+ if ( ! / ^ [ A - Z ] : / i. test ( zapFilePath ) ) {
745+ return
746+ }
747+
748+ let zapDrive = zapFilePath . split ( ':' ) [ 0 ]
749+ for ( const pkg of packages ) {
750+ let packagePath = pkg . path
751+ if (
752+ packagePath &&
753+ packagePath . split ( ':' ) [ 0 ] !== zapDrive &&
754+ path . isAbsolute ( packagePath )
755+ ) {
756+ let message =
757+ "Package path '" +
758+ packagePath +
759+ "' is on a different drive than the .zap file path. " +
760+ 'It is recommended that all packages reside on the same drive as the .zap file.'
761+ querySessionNotice . setNotification (
762+ db ,
763+ 'WARNING' ,
764+ message ,
765+ sessionId ,
766+ 1 ,
767+ 0
768+ )
769+ env . logWarning ( message )
770+ }
771+ }
772+ }
773+
733774/**
734775 * Retrieves the mandatory attributes of a cluster
735776 * @param {* } db
@@ -1693,6 +1734,14 @@ async function jsonDataLoader(
16931734 pkg . type == dbEnum . packageType . zclXmlStandalone
16941735 )
16951736
1737+ // checking if any packages are on a different drive than the zap file (Windows only)
1738+ await validatePackagePathDrive (
1739+ db ,
1740+ allPartitionPackages ,
1741+ state . filePath ,
1742+ sessionId
1743+ )
1744+
16961745 // Loading all packages before custom xml to make sure clusterExtensions are
16971746 // handled properly
16981747 let topLevelPackages = state . package . filter (
0 commit comments