Skip to content

Commit 3b37d32

Browse files
authored
Merge pull request OpenAssetIO#81 from feltech/work/OpenAssetIO-1257-pathToUrlWindowsMaxPath
[Docs] Long Windows paths in FilePathUrlConverter notebook
2 parents bd72775 + ab811a3 commit 3b37d32

File tree

1 file changed

+55
-18
lines changed

1 file changed

+55
-18
lines changed

examples/file_path_url_converter.ipynb

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"metadata": {
3434
"collapsed": false,
3535
"ExecuteTime": {
36-
"end_time": "2024-02-19T15:10:35.668132096Z",
37-
"start_time": "2024-02-19T15:10:35.661355780Z"
36+
"end_time": "2024-02-22T14:42:41.840621313Z",
37+
"start_time": "2024-02-22T14:42:41.826582123Z"
3838
}
3939
},
4040
"outputs": [],
@@ -74,8 +74,8 @@
7474
"metadata": {
7575
"collapsed": false,
7676
"ExecuteTime": {
77-
"end_time": "2024-02-19T15:10:35.750564608Z",
78-
"start_time": "2024-02-19T15:10:35.669692678Z"
77+
"end_time": "2024-02-22T14:42:41.874028812Z",
78+
"start_time": "2024-02-22T14:42:41.830823958Z"
7979
}
8080
},
8181
"outputs": [
@@ -115,8 +115,8 @@
115115
"metadata": {
116116
"collapsed": false,
117117
"ExecuteTime": {
118-
"end_time": "2024-02-19T15:10:35.751558242Z",
119-
"start_time": "2024-02-19T15:10:35.746229492Z"
118+
"end_time": "2024-02-22T14:42:41.905474515Z",
119+
"start_time": "2024-02-22T14:42:41.852589101Z"
120120
}
121121
},
122122
"outputs": [
@@ -152,8 +152,8 @@
152152
"metadata": {
153153
"collapsed": false,
154154
"ExecuteTime": {
155-
"end_time": "2024-02-19T15:10:35.752221829Z",
156-
"start_time": "2024-02-19T15:10:35.746760363Z"
155+
"end_time": "2024-02-22T14:42:41.906036777Z",
156+
"start_time": "2024-02-22T14:42:41.875777447Z"
157157
}
158158
},
159159
"outputs": [
@@ -227,8 +227,8 @@
227227
"metadata": {
228228
"collapsed": false,
229229
"ExecuteTime": {
230-
"end_time": "2024-02-19T15:10:35.752788470Z",
231-
"start_time": "2024-02-19T15:10:35.747166792Z"
230+
"end_time": "2024-02-22T14:42:41.906495146Z",
231+
"start_time": "2024-02-22T14:42:41.875950983Z"
232232
}
233233
},
234234
"outputs": [
@@ -267,8 +267,8 @@
267267
"metadata": {
268268
"collapsed": false,
269269
"ExecuteTime": {
270-
"end_time": "2024-02-19T15:10:35.753369976Z",
271-
"start_time": "2024-02-19T15:10:35.747539701Z"
270+
"end_time": "2024-02-22T14:42:41.969747703Z",
271+
"start_time": "2024-02-22T14:42:41.876084914Z"
272272
}
273273
},
274274
"outputs": [
@@ -324,8 +324,8 @@
324324
"metadata": {
325325
"collapsed": false,
326326
"ExecuteTime": {
327-
"end_time": "2024-02-19T15:10:35.754178890Z",
328-
"start_time": "2024-02-19T15:10:35.748805566Z"
327+
"end_time": "2024-02-22T14:42:41.970263505Z",
328+
"start_time": "2024-02-22T14:42:41.905686849Z"
329329
}
330330
},
331331
"outputs": [
@@ -371,9 +371,46 @@
371371
"collapsed": false
372372
},
373373
"source": [
374-
"Note that information is lost when converting to a `file` URL, i.e.whether the path was originally a device path or not. This can have implications for device paths that cannot be normalised, e.g. going beyond the `MAX_PATH` limit. Addressing this is the subject of future work."
374+
"Note that information is lost when converting to a `file` URL, i.e. whether the path was originally a device path or not. This can have implications for device paths that cannot be normalised by the Windows API. \n",
375+
"\n",
376+
"As a special case, paths that exceed the Windows `MAX_PATH` limit will be automatically converted to non-normalised device paths (i.e. prefixed with `\\\\?\\`):"
375377
]
376378
},
379+
{
380+
"cell_type": "code",
381+
"outputs": [
382+
{
383+
"data": {
384+
"text/markdown": "> **Result:**\n> - `Long drive path: \\\\?\\C:\\w\\012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234`\n> - `Long share path: \\\\?\\UNC\\host\\share\\0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456`"
385+
},
386+
"metadata": {},
387+
"output_type": "display_data"
388+
}
389+
],
390+
"source": [
391+
"long_drive_path = converter.pathFromUrl(\n",
392+
" \"file:///C:/w/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\"\n",
393+
" \"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234\",\n",
394+
" PathType.kWindows)\n",
395+
"\n",
396+
"long_unc_path = converter.pathFromUrl(\n",
397+
" \"file://host/share/\"\n",
398+
" \"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\"\n",
399+
" \"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456\",\n",
400+
" PathType.kWindows)\n",
401+
"\n",
402+
"display_result((f\"Long drive path: {long_drive_path}\", f\"Long share path: {long_unc_path}\"))"
403+
],
404+
"metadata": {
405+
"collapsed": false,
406+
"ExecuteTime": {
407+
"end_time": "2024-02-22T14:42:41.970844973Z",
408+
"start_time": "2024-02-22T14:42:41.905879463Z"
409+
}
410+
},
411+
"id": "6646fff173b8364e",
412+
"execution_count": 8
413+
},
377414
{
378415
"cell_type": "markdown",
379416
"id": "eb41ffc96d1228d9",
@@ -398,13 +435,13 @@
398435
},
399436
{
400437
"cell_type": "code",
401-
"execution_count": 8,
438+
"execution_count": 9,
402439
"id": "23bd55feb9d6f65b",
403440
"metadata": {
404441
"collapsed": false,
405442
"ExecuteTime": {
406-
"end_time": "2024-02-19T15:10:35.755287822Z",
407-
"start_time": "2024-02-19T15:10:35.749198579Z"
443+
"end_time": "2024-02-22T14:42:41.972347420Z",
444+
"start_time": "2024-02-22T14:42:41.948777138Z"
408445
}
409446
},
410447
"outputs": [

0 commit comments

Comments
 (0)