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>
308
308
< h1 > Select USB Host Folder</ h1 >
309
309
< 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 >
310
310
< 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 >
312
312
< button class ="purple-button first-item " id ="selectHostFolder "> Select New Folder</ button >
313
313
</ p >
314
314
</ div >
Original file line number Diff line number Diff line change @@ -56,6 +56,25 @@ function isLocal() {
56
56
return ( isMdns ( ) || location . hostname == "localhost" || isIp ( ) ) && ( location . pathname == "/code/" ) ;
57
57
}
58
58
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
+
59
78
// Parse out the url parameters from the current url
60
79
function getUrlParams ( ) {
61
80
// This should look for and validate very specific values
@@ -146,6 +165,8 @@ export {
146
165
isMdns ,
147
166
isIp ,
148
167
isLocal ,
168
+ isMicrosoftWindows ,
169
+ isChromeOs ,
149
170
getUrlParams ,
150
171
getUrlParam ,
151
172
timeout ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import {GenericModal, DeviceInfoModal} from '../common/dialogs.js';
4
4
import { FileOps } from '@adafruit/circuitpython-repl-js' ; // Use this to determine which FileTransferClient to load
5
5
import { FileTransferClient as ReplFileTransferClient } from '../common/repl-file-transfer.js' ;
6
6
import { FileTransferClient as FSAPIFileTransferClient } from '../common/fsapi-file-transfer.js' ;
7
+ import { isChromeOs , isMicrosoftWindows } from '../common/utilities.js' ;
7
8
8
9
let btnRequestSerialDevice , btnSelectHostFolder , btnUseHostFolder , lblWorkingfolder ;
9
10
@@ -247,7 +248,11 @@ class USBWorkflow extends Workflow {
247
248
console . log ( "New folder name:" , folderName ) ;
248
249
if ( folderName ) {
249
250
// 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
+ }
251
256
btnUseHostFolder . classList . remove ( "hidden" ) ;
252
257
btnSelectHostFolder . innerHTML = "Select Different Folder" ;
253
258
btnSelectHostFolder . classList . add ( "inverted" ) ;
You can’t perform that action at this time.
0 commit comments