File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ <h1>Select Serial Device</h1>
308308 < h1 > Select USB Host Folder</ h1 >
309309 < p > Select the root folder of your device. This is typically the CIRCUITPY Drive on your computer unless you renamed it. If your device does not appear as a drive on your computer, it will need to have the USB Host functionality enabled.</ p >
310310 < p >
311- < button class ="purple-button hidden " id ="useHostFolder "> Use < span id ="workingFolder "> </ span > </ button >
311+ < button class ="purple-button hidden " id ="useHostFolder "> < span id ="workingFolder "> </ span > </ button >
312312 < button class ="purple-button first-item " id ="selectHostFolder "> Select New Folder</ button >
313313 </ p >
314314 </ div >
Original file line number Diff line number Diff line change @@ -56,6 +56,25 @@ function isLocal() {
5656 return ( isMdns ( ) || location . hostname == "localhost" || isIp ( ) ) && ( location . pathname == "/code/" ) ;
5757}
5858
59+ // Test to see if browser is running on Microsoft Windows OS
60+ function isMicrosoftWindows ( ) {
61+ // Newer test on Chromium
62+ if ( navigator . userAgentData ?. platform === "Windows" ) {
63+ return true ;
64+ } else if ( navigator . userAgent . includes ( "Windows" ) ) {
65+ return true ;
66+ }
67+ return false ;
68+ }
69+
70+ // Test to see if browser is running on Microsoft Windows OS
71+ function isChromeOs ( ) {
72+ if ( navigator . userAgent . includes ( "CrOS" ) ) {
73+ return true ;
74+ }
75+ return false ;
76+ }
77+
5978// Parse out the url parameters from the current url
6079function getUrlParams ( ) {
6180 // This should look for and validate very specific values
@@ -146,6 +165,8 @@ export {
146165 isMdns ,
147166 isIp ,
148167 isLocal ,
168+ isMicrosoftWindows ,
169+ isChromeOs ,
149170 getUrlParams ,
150171 getUrlParam ,
151172 timeout ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import {GenericModal, DeviceInfoModal} from '../common/dialogs.js';
44import { FileOps } from '@adafruit/circuitpython-repl-js' ; // Use this to determine which FileTransferClient to load
55import { FileTransferClient as ReplFileTransferClient } from '../common/repl-file-transfer.js' ;
66import { FileTransferClient as FSAPIFileTransferClient } from '../common/fsapi-file-transfer.js' ;
7+ import { isChromeOs , isMicrosoftWindows } from '../common/utilities.js' ;
78
89let btnRequestSerialDevice , btnSelectHostFolder , btnUseHostFolder , lblWorkingfolder ;
910
@@ -247,7 +248,11 @@ class USBWorkflow extends Workflow {
247248 console . log ( "New folder name:" , folderName ) ;
248249 if ( folderName ) {
249250 // Set the working folder label
250- lblWorkingfolder . innerHTML = folderName ;
251+ if ( isMicrosoftWindows ( ) || isChromeOs ( ) ) {
252+ lblWorkingfolder . innerHTML = "OK" ;
253+ } else {
254+ lblWorkingfolder . innerHTML = `Use ${ folderName } ` ;
255+ }
251256 btnUseHostFolder . classList . remove ( "hidden" ) ;
252257 btnSelectHostFolder . innerHTML = "Select Different Folder" ;
253258 btnSelectHostFolder . classList . add ( "inverted" ) ;
You can’t perform that action at this time.
0 commit comments